scala> class A
defined class A
scala> trait X extends A
defined trait X
scala> trait Y { self: A => }
defined trait Y
scala> val x = new X {}
x: A with X = $anon$1@3e23fe9c
scala> val y = new Y {}
<console>:9: error: illegal inheritance;
self-type Y does not conform to Y's selftype Y with A
val y = new Y {}
^
Created
January 19, 2016 20:00
-
-
Save gakuzzzz/d330481459ff17dab8ef to your computer and use it in GitHub Desktop.
trait extends class と self type annotation の違い
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment