Open uosis opened 1 week ago
The following with member A
prints false
twice
class B:
class A {
override def equals(x: Any): Boolean = x match {
case a: A => true
case _ => false
}
}
def f(x: Any): Any = {
val y = A()
println(y == x)
y
}
@main def test() =
val b0 = B()
val f = b0.f(null)
val b1 = B()
b1.f(f)
but with local A
, it is false
(of course) then true
. It's merely testing the implementation class.
Not sure if more words from the code comment would be elucidating:
8. if `P` is a local class which is not statically reachable from the scope where `X` is defined, "it's a local class"
Can I try my hand at this one? Sounds interesting
Compiler version
Tested 3.4.2, 3.4.1, 3.4.0, 3.3.3, all with the same issue.
2.13.14 works fine and does not emit warning.
Minimized example
Output Error/Warning message
Why this Error/Warning was not helpful
The code seems correct and runs correctly, i.e. the type test executes correctly at runtime, contradictory to the warning.
Suggested improvement
No warning should be emitted.