-
Notifications
You must be signed in to change notification settings - Fork 129
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
Support attributes in symbolic expressions #1369
Conversation
…n the corresponding field type if necessary.
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.
We will need updates for multi-nested Structures, but let's do it step by step.
… name. No more explicit replacement of dots in the allocation methods.
@@ -405,6 +405,9 @@ def _infer_dtype(t: Union[ast.Name, ast.Attribute]): | |||
|
|||
def _Attribute(t, symbols, inferred_symbols): | |||
inferred_type = _dispatch(t.value, symbols, inferred_symbols) | |||
if (isinstance(inferred_type, dtypes.pointer) and isinstance(inferred_type.base_type, dtypes.struct) and |
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.
@alexnick83 what about plain structs (i.e., not pointers)
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.
Since we have decided that Structures will always resolve to a pointer to a struct, I think it is better to not handle that case (now), since it might be something unrelated to nested data and cause further confusion.
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.
Note: This assumption was valid for the time being, but I am now arguing to change that assumption. For cases where the type of an expression is being evaluated, where the t.value
type of an Attribute expression is not merely a structure, but an array of structures (indexed through a Slice), the returned inferred_type
is no longer a pointer but directly a plain struct.
Example: my_array_of_structs[i].my_attribute
Commit e2561ed implements a handle for this additional case.
I do not know how to make tests for that.