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

Missing expected types for SAM overload resolution #11703

szeiger opened this issue Aug 21, 2019 · 0 comments


Copy link

commented Aug 21, 2019

As reported in, SAM overload resolution doesn't work in this case:

trait SAM[A, B] { def foo(a: A): B }
def foo(sam: SAM[Int, String]): String = ???
def foo(sam: SAM[Int, Unit]): Unit = ???
foo(x => x.toString)

The problem is in OverloadedArgProto.toWild which was introduced with the changes in scala/scala#6871. One of the cases that should be supported is:

: all overloads expect a SAM type of the same class, but with potentially varying result types
(argument types must be =:=)

This is supposed to be handled in scala/scala@cd70540#diff-ecaa4198a04261cd0e00a708b695eafbR1316 but toWild only erases undetermined type params. It should also erase already instantiated type params which are irrelevant for the parameter types of the SAMs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.