Created
May 20, 2013 11:25
-
-
Save milessabin/5611702 to your computer and use it in GitHub Desktop.
Since when was "<:" an alias for "extends" ... not that I'm complaining, mind ;-)
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> trait Foo ; trait Bar <: Foo | |
defined trait Foo | |
defined trait Bar | |
scala> implicitly[Bar <:< Foo] | |
res2: <:<[Bar,Foo] = <function1> |
Also throws an error for abstract classes
2.9.2 and 2.8.2 also works!
but 2.7.7
scala> trait Foo ; trait Bar <: Foo
<console>:1: error: ';' expected but '<:' found.
trait Foo ; trait Bar <: Foo
^
@larsrh discovered this in scalac,
if (in.token == EXTENDS ||
settings.YvirtClasses && (mods hasFlag Flags.TRAIT) && in.token == SUBTYPE) { ...
So it looks like it's a relic of the virtual classes experiment.
In general, it seems to be nice to have either <:
or extends
, not both.
This would appear to be the offending commit (search for YvirtClasses) scala/scala@4253124 ... calling @paulp ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But (at least in 2.10.1):