I noticed that I can instantiate a scala trait with an abstract type member. The code below compiles. But what is the t.B?
trait A {
type B
}
val t = new A {}
I noticed that I can instantiate a scala trait with an abstract type member. The code below compiles. But what is the t.B?
trait A {
type B
}
val t = new A {}
The type is
t.B
.has the error
Types don't have to be "overriden" like methods.
This type is its own thing. It's not very useful, but that's what it is.
Like all other types, it is a subtype of
Any
and a supertype ofNothing
.And that's about all that can be said about it.