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

Fix the desugaring of struct update #630

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

quark17
Copy link
Collaborator

@quark17 quark17 commented Oct 19, 2023

This addresses GitHub issue #628. It mostly fixes issues around qualified field names, which is only allowed in BH, but it also fixes the position of the fields in the new expression, which might improve position information for errors in BSV. Test cases are added, for struct update as well as struct construction and pattern matching.

This addresses GitHub issue 628, by fixing the desugaring of struct
updates during typecheck.  It mostly fixes issues around qualified
field names, which is only allowed in BH, but it also fixes the
position of the fields in the new expression, which might improve
position information for errors in BSV.

Test cases are added for both qualified and unqualified field names in
struct update, construction, and pattern matching.  Further tests are
added for incorrect qualifiers and duplicate field names with the same
base name (such as qualified and unqualified).

The typecheck of CStruct had been fixed in 2006 to account for
qualifiers (in most situations), but similar code in the typecheck of
CStructUpd that needed the same fix was overlooked, and typecheck of
CPstruct was even further behind.  These are all updated, with
additional comments and some improved variable names.
@quark17 quark17 merged commit 9a4e8ff into B-Lang-org:main Oct 20, 2023
33 checks passed
@quark17 quark17 deleted the tcheck-cstructupd branch October 20, 2023 03:39
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.

bs classic: struct update syntax of struct from import qualified gives error for the wrong file.
1 participant