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 literal inference through partial function #3729

Merged
merged 1 commit into from
Mar 11, 2021

Conversation

ergl
Copy link
Member

@ergl ergl commented Mar 11, 2021

Before this change, code such as 1~add(2) would hit an assertion error
when the compiler tried to infer the type of the literal 2. The compiler
tries to find the type of the receiver of the function, in this case
1, but it lacked the ability to do so when using partial functions. In
those cases, the compiler would try to look at the type of the ~
token, which is not a valid value literal, and as such it would fail.

Fixes #3531

Before this change, code such as `1~add(2)` would hit an assertion error
when the compiler tried to infer the type of the literal `2`. The compiler
tries to find the type of the receiver of the function, in this case
`1`, but it lacked the ability to do so when using partial functions. In
those cases, the compiler would try to look at the type of the `~`
token, which is not a valid value literal, and as such it would fail.
@ergl ergl force-pushed the fix_partial_literal_inference branch from 53b6715 to b147a1a Compare March 11, 2021 22:11
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Mar 11, 2021
@@ -0,0 +1,3 @@
## Fix literal inference with partial functions

Before this change, code such as `1~add(2)` would hit an assertion error when the compiler tried to infer the type of the literal `2`. The compiler tries to find the type of the receiver of the function (in this case `1`), but before it lacked the ability to do so when using partial functions. In those cases, the compiler would try to look at the type of the `~` token, which is not a valid value literal, and as such it would fail.
Copy link
Member

Choose a reason for hiding this comment

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

Nice release note.

@SeanTAllen SeanTAllen merged commit 93a2aaa into main Mar 11, 2021
@SeanTAllen SeanTAllen deleted the fix_partial_literal_inference branch March 11, 2021 23:46
github-actions bot pushed a commit that referenced this pull request Mar 11, 2021
github-actions bot pushed a commit that referenced this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Literal partial application leads to crash
2 participants