Skip to content

Fix #2367: Allow SAM conversion for overloaded functions #2894

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
Jul 25, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 20, 2017

If just one of a number of alternatives takes a SAM, allow a lambda argument,
just like we do for non-overloaded methods with SAM type parameters.

If just one of a number of alternatives takes a SAM, allow a lambda argument,
just like we do for non-overloaded methods with SAM type parameters.
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

LGTM

case SAMType(meth) => argtpe <:< meth.info.toFunctionType()
case _ => false
}
isCompatible(argtpe, formal) || ctx.mode.is(Mode.ImplicitsEnabled) && SAMargOK
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add some note that implicit search and SAM conversion are tried at the same time to justify checking ImplicitsEnabled here?

@DarkDimius DarkDimius merged commit 9018807 into scala:master Jul 25, 2017
@allanrenucci allanrenucci deleted the fix-#2367 branch December 14, 2017 19:18
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