-
Notifications
You must be signed in to change notification settings - Fork 21
Singleton type has wrong bounds. #1273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1273?orig=1 |
@odersky said: |
@odersky said: |
@paulp said: The good news though is that that's the same reason the lower bound is wrong, and assigning AnyRef as the parent fixes that too. Making this change doesn't seem to bother the compiler in the least. All builds, all passes. Specwise, from my reading of it all singleton types must descend from AnyRef, but the same is not explicitly said of scala.Singleton. Someone reading it would be rather likely to think Singleton <: AnyRef. Perhaps it should be worded more clearly regardless of outcome. A singleton type is of the form p.type, where p is a path pointing to a value expected to conform (�6.1) to scala.AnyRef. The type denotes the set of values consisting of null and the value denoted by p.
A stable type is either a singleton type or a type which is declared to be a subtype of trait scala.Singleton. |
@milessabin said: |
@SethTisue said: |
A singleton type is always inhabited by an object reference, and null. Hence the type
Singleton
should have bounds>: Null <: AnyRef
. However, this is not currently the case:In particular it seems obviously erroneous that
Null <: Singleton
doesn't hold, sinceNull <: a.type
anda.type <: Singleton
for any referencea
. So the transitivity of type conformance seems to be broken.The text was updated successfully, but these errors were encountered: