-
Notifications
You must be signed in to change notification settings - Fork 56
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
#659 array of struct initialization #663
Conversation
Codecov ReportBase: 93.90% // Head: 93.93% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #663 +/- ##
==========================================
+ Coverage 93.90% 93.93% +0.03%
==========================================
Files 46 46
Lines 17938 17964 +26
==========================================
+ Hits 16844 16874 +30
+ Misses 1094 1090 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
good job, I really thought this would be much more complicated when I saw the issue.
I did a quick test regarding the comment about the get_effective_type(...)
. Can you verify that it solves the problem?
btw. I added the situation to your unit test and I think it fails.
@@ -3774,3 +3774,50 @@ fn multiple_negative_annotates_correctly() { | |||
} | |||
} | |||
} | |||
|
|||
#[test] | |||
fn array_of_struct_with_inital_values_annotated_correctly() { |
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.
👍 I like your thoughtful testing!
The problem we got is how we generate STRUCTs
for STRUCTs we got an ExpressionList with Assignments for the fields
When we try to initialize an ARRAY we performed flatten_expression_list on the passed initializer to get rid of the first ExpressionList (because ARRAY initializer will always be an ExpressionList)
This will return a vector of Assignments, leading to the problem we got
Solution:
For ARRAY of STRUCT get rid of the first ExpressionList and work with the contained vector of AstStatements, this will preserve the ExpressionLists of Assignments for STRUCTs