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 name resolution in typealias with constraint #144

Merged

Conversation

KushalP
Copy link
Contributor

@KushalP KushalP commented Feb 13, 2024

The body of a typealias gets inlined into wherever the typealias is used. This fixes a bug where the name resolution would resolve an additional type constraint on the next scope of this.

Lack of a frame scope

typealias doesn't currently have a frame scope, which is why we have to assign the owner and the receiver here. If it did, we could read both of these at the point where we're trying to resolve the typealias in question.

@KushalP KushalP force-pushed the fix-name-resolution-typealias-with-constraint branch from ea005f8 to 46f4c0c Compare February 13, 2024 20:43
Copy link
Contributor

@bioball bioball left a comment

Choose a reason for hiding this comment

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

This looks pretty good! Left some comments but overall it seems like this fixes the bug.

The body of a `typealias` gets inlined into wherever the `typealias`
is used. This fixes a bug where the name resolution would resolve an
additional type constraint on the next scope of `this`.

Lack of a frame scope
---------------------

`typealias` doesn't currently have a frame scope, which is why we have to assign
the `owner` and the `receiver` here. If it did, we could read both of these
at the point where we're trying to resolve the `typealias` in question.
@KushalP KushalP force-pushed the fix-name-resolution-typealias-with-constraint branch from 46f4c0c to bbcb5cf Compare February 15, 2024 20:58
@KushalP
Copy link
Contributor Author

KushalP commented Feb 15, 2024

Thanks. I have amended and pushed.

@KushalP KushalP requested a review from bioball February 15, 2024 21:26
@bioball bioball merged commit 3d1db25 into apple:main Feb 15, 2024
4 checks passed
@KushalP KushalP deleted the fix-name-resolution-typealias-with-constraint branch February 15, 2024 21:28
HT154 pushed a commit to HT154/pkl that referenced this pull request Apr 2, 2024
The body of a typealias gets inlined into wherever the typealias
is used. This fixes a bug where the references in the typealias body can
resolve to the wrong value.
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.

None yet

2 participants