-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix type resolution for field access via variables #1450
Conversation
Would it be possible to test this behaviour? Our ci doesn't run these kfunc tests yet but they would be good to have to avoid regressions |
d1d5db3
to
4aeebca
Compare
Good point, I added a new test case for this. Also verified that the test doesn't pass without this fix. |
One of the CI tests failed but it is not related to this PR. I think that a restart should fix that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
Rerunning tests |
Failed on Docker container build this time. |
yeey tests finally pass. Can you fix the clang formatting issues? :) |
4aeebca
to
b93170c
Compare
@viktormalik can you update the changelog too? |
If a variable of a (pointer to) struct type is defined, its type must be saved. Later, when the variable is used, the stored type helps to correctly resolve types of following field accesses. Fixes iovisor#1362. Add a unit test that requires this fix.
b93170c
to
386b74c
Compare
Sure, done. |
Fixes #1362
The problem is that the field analyser was not able to correctly resolve struct field types if a variable (of struct type) was used because it doesn't remember the variable type.
It only worked for cases when the variable was used right after its definition since the type was remembered in the
type_
field of the field analyser (see the linked issue for examples).This PR fixes the problem by storing the variable type and using it when the variable is used.
Checklist
docs/reference_guide.md
CHANGELOG.md