-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compiling collections: dotty deviation: scalac seems to assume that class tparams are always subtypes of AnyREf #780
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
This is not specific to class Foo[A] {
def foo[B >: A <: Int] = 0 // scalac: works, dotc: lower bound does not conform to upper bound
} This was reported as #525 |
@DarkDimius, @odersky : note that unlike what we discussed, scalac does have transitive subtyping: class Foo[A](x: A) {
def foo[B >: A <: AnyRef] = {
x eq null // error: value eq is not a member of type parameter A
}
} The issue that @DarkDimius was seeing after removing the If we remove the conformance check in dotty (https://github.com/lampepfl/dotty/blob/master/src/dotty/tools/dotc/typer/Typer.scala#L846-L847, this is not a proper fix because we need to keep the check to disallow things like List.scala:417: error: object creation impossible, since:
it has 2 unimplemented members.
/** As seen from module class Nil$, the missing signatures are as follows.
* For convenience, these are usable as stub implementations.
*/
def productArity: => Int = ???
def productElement: (n: Int)Any = ???
case object Nil extends List[Nothing] {
^ This is because of issue #723. We can work around this issue by adding |
@smarter, on my local setup, I am not seeing second error. Are you sure that you are running on master? |
Yes, I'm on master, here's my |
@smarter scalac also accepts
Whereas this one succeeds:
I don't know what the deal with |
The text was updated successfully, but these errors were encountered: