Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

No description provided.

@DarkDimius
Copy link
Contributor

why?

@nicolasstucki
Copy link
Contributor Author

Because scalac allows it.

Furthermore it is already possible to have abstract types in objects by defining it in a trait

trait A { type T <: Any } object B extends A // B has the abstract type T

In this case it would be simpler to define it as

object B { type T <: Any }
@odersky
Copy link
Contributor

odersky commented Mar 2, 2017

Do we have a test that checks that bounds of abstract type members are non-empty, i.e. lower bound <: upper bound? In that case, LGTM

val v = new V {} // error: cannot be instantiated
v.brand("boom!")
}
object V { // error: cannot be instantiated
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error of the bound >: Any <: Nothing is the reason for the cannot be instantiated error, the full message is quite clear on the source of the issue.

@odersky odersky merged commit 917a7ed into scala:master Mar 3, 2017
@sjrd
Copy link
Member

sjrd commented Mar 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants