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

Ensure owner and receiver are reset after executing alias #373

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

bioball
Copy link
Contributor

@bioball bioball commented Mar 28, 2024

This fixes an issue where the frame's owner/receiver are not reset if a type test on a typealias fails.

This fixes an issue where the frame's owner/receiver are not reset
if a type test on a typealias fails.

res8 = new {
foo = 5
bar = if (foo is MappingOrListing) "bar" else foo
Copy link
Contributor Author

@bioball bioball Mar 28, 2024

Choose a reason for hiding this comment

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

This was failing in the main branch because the type check on MappingOrListing (aliasedTypeNode.execute(...) throws a (caught) type check exception. But it gets caught further up the stack, so logic for resetting the owner/receiver aren't run. Pkl then executes the else branch, and the owner/receiver are incorrectly set to the module.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch


res8 = new {
foo = 5
bar = if (foo is MappingOrListing) "bar" else foo
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch

@bioball bioball merged commit 28448b5 into apple:main Mar 28, 2024
5 checks passed
@bioball bioball deleted the typealias-bugfix branch March 28, 2024 14:58
HT154 pushed a commit to HT154/pkl that referenced this pull request Apr 2, 2024
This fixes an issue where the frame's owner/receiver are not reset
if a type test on a typealias fails.
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