Skip to content

Better function return type inference #3571

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

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

smarter
Copy link
Member

@smarter smarter commented Nov 27, 2017

If the function prototype is a type variable, its upper bound might
contain useful information for inferring the return type of the
function. Before this PR, the added testcases failed because () => 4
was typed as () => Int and () => new Inv as () => Inv[Nothing],
even though the expected types of the functions give enough information
to correctly infer them.

If the function prototype is a type variable, its upper bound might
contain useful information for inferring the return type of the
function. Before this PR, the added testcases failed because `() => 4`
was typed as `() => Int` and `() => new Inv` as `() => Inv[Nothing]`,
even though the expected types of the functions give enough information
to correctly infer them.
@smarter smarter requested a review from odersky November 27, 2017 21:39
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

LGTM

@allanrenucci allanrenucci merged commit 634d153 into scala:master Nov 29, 2017
@allanrenucci allanrenucci deleted the fix-function-inference branch November 29, 2017 08:36
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.

3 participants