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

Make .as?(NoReturn) always return nil #10896

Merged

Conversation

HertzDevil
Copy link
Contributor

The irreducible union type NoReturn | Nil can leak through the expression x.as?(NoReturn), but the same union should reduce to Nil because NoReturn is the bottom type. This PR fixes that.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic topic:lang:type-system labels Jul 6, 2021
@straight-shoota straight-shoota modified the milestones: 1.1.0, 1.2.0 Jul 9, 2021
@straight-shoota
Copy link
Member

I'd rather postpone this to 1.2 because we're about to release 1.1 and this might have some unexpected effects. It's not an urgent fix.

@straight-shoota straight-shoota merged commit 1002886 into crystal-lang:master Jul 23, 2021
@HertzDevil HertzDevil deleted the bug/nilable-noreturn-cast branch July 23, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic topic:lang:type-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants