Skip to content
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

parser: Fix assignability check by tracking type context #296

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

juliaogris
Copy link
Member

@juliaogris juliaogris commented Mar 15, 2024

Fix assignability check by tracking type context in Type.Fixed flag: A
variable or expression of composite type has its type field Fixed set to
true. All other types, including literal composite Types have the Type.Fixed
field set to false.

This allows the Type.accept(otherType) method to work without the additional,
previously used isConst parameter, which was also imprecise. We can also
remove the isCompositeConst and isConst functions from the ast.go file.

Additionally rework the combineTypes() function to work with the new
Type.Fixed flag.

Add test cases to parser and evaluator package that cover all noted crashes on
nested types.

Issue: #295


Fixes #295

Fix assignability check by tracking type context in Type.Fixed flag: A
variable or expression of composite type has its type field Fixed set to
true. All other types, including literal composite Types have the Type.Fixed
field set to false.

This allows the Type.accept(otherType) method to work without the additional,
previously used `isConst` parameter, which was also imprecise. We can also
remove the `isCompositeConst` and `isConst` functions from the ast.go file.

Additionally rework the `combineTypes()` function to work with the new
Type.Fixed flag.

Add test cases to parser and evaluator package that cover all noted crashes on
nested types.

Issue: #295
Copy link
Member

@camh- camh- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💚

@juliaogris juliaogris merged commit 5147aae into main Mar 21, 2024
3 checks passed
@juliaogris juliaogris deleted the const-lit-fix branch March 21, 2024 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline nested map crashes
2 participants