You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--Error: test.scala:3:39------------------------------------------------------3|valb:B=newB { typeX=Int; defmkX(i: Int):X= i }
|^| error overriding method mkX in traitB of type (i: Int): test.B#X;
| method mkX of type (i: Int):X has incompatible type1 error found
expectation
Should compile. Note that this already compiles:
trait B { type X; def mkX(i: Int): X }
val b: B = new B { type X = Int; def mkX(i: Int): X = i }
implicitly[b.X <:< B#X]
From the outside X is a subtype of B#X but inside new B { } not.