Last active
November 28, 2017 15:19
-
-
Save mpilquist/b89a5fa05a480774d280e9c6aa999d97 to your computer and use it in GitHub Desktop.
Type inference issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Example { | |
trait H[A] | |
def id[A]: H[A] => H[A] = in => in | |
def apply[A,B](h: H[A], f: H[A] => H[B]): H[B] = f(h) | |
def applyIdExplicitType[A](h: H[A]): H[A] = apply(h, id) | |
// Fails in 2.11,2.12,2.13-M2, works in Dotty | |
// found : Example.H[Nothing] => Example.H[Nothing] | |
// required: Example.H[A] => Example.H[B] | |
def applyIdInferredType[A](h: H[A]) = apply(h, id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment