Repository navigation
[DSLX] Support Self { ... } struct instances in IR conversion. - #5544
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
IR conversion assumed that the type of a struct instance is always a type
reference. Inside an impl it can also be `Self` (`Self { field: ... }` or
`Self { ..self }`), which made IR conversion crash even though type checking
and the interpreter accept the code. Resolve `Self` to the impl's struct, and
return an error instead of crashing on any other annotation kind.
Adds the impl_self_struct_instance DSLX language test (plain, splat, and
parametric struct cases), which converts to IR and checks IR equivalence.
PiperOrigin-RevId: 1023922255
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[DSLX] Support
Self { ... }struct instances in IR conversion.IR conversion assumed that the type of a struct instance is always a type
reference. Inside an impl it can also be
Self(Self { field: ... }orSelf { ..self }), which made IR conversion crash even though type checkingand the interpreter accept the code. Resolve
Selfto the impl's struct, andreturn an error instead of crashing on any other annotation kind.
Adds the impl_self_struct_instance DSLX language test (plain, splat, and
parametric struct cases), which converts to IR and checks IR equivalence.