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

special handling for Completion/NormalCompletion in the typechecker #613

Merged
merged 3 commits into from
Sep 22, 2024

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Sep 17, 2024

Based on #612.

We don't (and are not going to) have generic types, so just hardcode these specific generic types. Also observe that a normal completion of never is equivalent to never, which allows us to get errors when passing NormalCompletion(x) to NormalCompletion(not-x). The latter doesn't really come up for arguments but it does for returned values, which I want to handle soon.

@bakkot bakkot force-pushed the handle-completions-better branch 2 times, most recently from c2f270f to 5a93027 Compare September 17, 2024 16:57
@bakkot bakkot mentioned this pull request Sep 17, 2024
src/type-logic.ts Outdated Show resolved Hide resolved
Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

We should add an assertNoTypeError test for a normal completion containing an ECMAScript language value and NormalCompletion(*true*) or something (the normal completion parameter type being a subtype of the declared type).

Base automatically changed from refactor-typechecker to main September 18, 2024 02:17
@bakkot
Copy link
Contributor Author

bakkot commented Sep 18, 2024

We should add an assertNoTypeError test for a normal completion containing an ECMAScript language value and NormalCompletion(*true*) or something (the normal completion parameter type being a subtype of the declared type).

Done. Though our type system represents false as a distinct type from Boolean, so strictly speaking we already had that.

@michaelficarra
Copy link
Member

I guess we could simplify that other test to a normal completion containing *false* if we wanted.

@bakkot bakkot merged commit adc69b2 into main Sep 22, 2024
2 checks passed
@bakkot bakkot deleted the handle-completions-better branch September 22, 2024 17:47
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.

2 participants