-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
cannot override generic Java method instantiated with value class with -Yexplicit-nulls #15194
Comments
Related to #13837 |
A simpler example is: object IntOrd extends Ordering[Int] {
def compare(i: Int, j: Int) = ???
}
One cannot define An even simpler example is for Thinking about this some more, I think I have a solution: For AnyRef types, we already ignore A problem would then be that we allow class D {
def foo(s: Int) = ???
def foo(s: Int|Null) = ???
} This creates an ambiguity if If
I'd be interested in the thoughts of @odersky and @smarter as the experts on erasure and bridge methods. |
As a side comment, I found an example in which we are already less sound with def f(o: Ordering[Int]) = {
(o: java.util.Comparator[Int]).compare(null, null)
} |
Compiler version
Scala compiler version 3.2.0-RC1-bin-SNAPSHOT-git-7fbbeef -- Copyright 2002-2022, LAMP/EPFL
Minimized code
Compile with
scalac -Yexplicit-nulls PosZLong.scala
Minimized from scalatest/scalactic.
Output
Expectation
Should compile.
Fails to compile independently of
language.unsafeNulls
.Probably related to #13975.
Blocker in community build for scalatest and the many projects that depend on it.
The text was updated successfully, but these errors were encountered: