Created
July 13, 2011 08:29
-
-
Save itang/1079929 to your computer and use it in GitHub Desktop.
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
scala> def a[T](i:T)(implicit ev: =:=[String, T]) = println(i) | |
a: [T](i: T)(implicit ev: =:=[String,T])Unit | |
scala> def test[T <: Any](a : T)(implicit ev : T =:= String) = println(a) | |
test: [T](a: T)(implicit ev: =:=[T,String])Unit | |
scala> test("aa") | |
aa | |
scala> test(1) | |
<console>:12: error: Cannot prove that Int =:= String. | |
test(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment