Created
April 16, 2014 20:19
-
-
Save retronym/10928835 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 id[A <: AnyRef](a: A): a.type = a | |
id: [A <: AnyRef](a: A)a.type | |
scala> val c = ""; id(c): c.type | |
c: String = "" | |
res0: c.type = "" | |
scala> val c = ""; { val temp = c; id(temp)} : c.type | |
<console>:11: error: type mismatch; | |
found : temp.type (with underlying type String) | |
required: c.type | |
{ val temp = c; id(temp)} : c.type | |
^ | |
scala> val c = ""; { val temp: c.type = c; id(temp)} : c.type | |
c: String = "" | |
res2: c.type = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment