You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" dotty.tools.dotc.core.TypeError:Failure to disambiguate overloaded reference with
method compareTo in traitComparable: (x$0: Outer.this.LocalName|Null):Int and
method compareTo in className: (that: Outer.this.LocalName#ThisName):IntFailure to disambiguate overloaded reference with
method compareTo in traitComparable: (x$0: Outer.this.LocalName|Null):Int and
method compareTo in className: (that: Outer.this.LocalName#ThisName):Intwhile compiling example/Outer.scala
at dotty.tools.dotc.core.Denotations$MultiDenotation.suchThat(Denotations.scala:1243)
at dotty.tools.dotc.core.Denotations$Denotation.matchingDenotation(Denotations.scala:358)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.matchingMember(SymDenotations.scala:1300)
at dotty.tools.dotc.transform.init.Semantic$.resolve(Semantic.scala:1578)
at dotty.tools.dotc.transform.init.Semantic$.call(Semantic.scala:627)
at dotty.tools.dotc.transform.init.Semantic$.tryPromote$$anonfun$1$$anonfun$1(Semantic.scala:949)
at dotty.tools.dotc.core.Scopes$Scope.filter(Scopes.scala:102)
at dotty.tools.dotc.core.Scopes$Scope.exists(Scopes.scala:109)
at dotty.tools.dotc.transform.init.Semantic$.tryPromote$$anonfun$1(Semantic.scala:956)
at scala.collection.immutable.List.exists(List.scala:395)
at dotty.tools.dotc.transform.init.Semantic$.tryPromote(Semantic.scala:956)
at dotty.tools.dotc.transform.init.Semantic$.promote(Semantic.scala:895)
at dotty.tools.dotc.transform.init.Semantic$ArgInfo.promote(Semantic.scala:1051)
at dotty.tools.dotc.transform.init.Semantic$.checkArgs$1$$anonfun$1(Semantic.scala:591)
at scala.collection.immutable.List.flatMap(List.scala:293)
at dotty.tools.dotc.transform.init.Semantic$.checkArgs$1(Semantic.scala:591)
at dotty.tools.dotc.transform.init.Semantic$.call(Semantic.scala:613)
at dotty.tools.dotc.transform.init.Semantic$Result.call(Semantic.scala:414)
at dotty.tools.dotc.transform.init.Semantic$.cases(Semantic.scala:1151)
at dotty.tools.dotc.transform.init.Semantic$.eval$$anonfun$1(Semantic.scala:1071)
at dotty.tools.dotc.transform.init.Semantic$Cache$Cache.assume(Semantic.scala:314)
at dotty.tools.dotc.transform.init.Semantic$.eval(Semantic.scala:1071)
at dotty.tools.dotc.transform.init.Semantic$.init$$anonfun$4(Semantic.scala:1487)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.transform.init.Semantic$.init(Semantic.scala:1488)
at dotty.tools.dotc.transform.init.Semantic$.cases(Semantic.scala:1265)
at dotty.tools.dotc.transform.init.Semantic$.eval$$anonfun$1(Semantic.scala:1071)
at dotty.tools.dotc.transform.init.Semantic$Cache$Cache.assume(Semantic.scala:314)
at dotty.tools.dotc.transform.init.Semantic$.eval(Semantic.scala:1071)
at dotty.tools.dotc.transform.init.Semantic$.dotty$tools$dotc$transform$init$Semantic$WorkList$$_$iterate$1(Semantic.scala:1008)
at dotty.tools.dotc.transform.init.Semantic$WorkList.doTask(Semantic.scala:1019)
at dotty.tools.dotc.transform.init.Semantic$WorkList.work$$anonfun$1(Semantic.scala:989)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.transform.init.Semantic$WorkList.work(Semantic.scala:989)
at dotty.tools.dotc.transform.init.Semantic$.check(Semantic.scala:1033)
at dotty.tools.dotc.transform.init.Checker.runOn$$anonfun$1(Checker.scala:38)
at dotty.tools.dotc.transform.init.Semantic$.withInitialState(Semantic.scala:1044)
at dotty.tools.dotc.transform.init.Checker.runOn(Checker.scala:40)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:225)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:236)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:244)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:253)
at dotty.tools.dotc.Run.compileSources(Run.scala:186)
at dotty.tools.dotc.Run.compile(Run.scala:170)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
at dotty.tools.dotc.Driver.process(Driver.scala:195)
at dotty.tools.dotc.Driver.process(Driver.scala:163)
at dotty.tools.dotc.Driver.process(Driver.scala:175)
at dotty.tools.dotc.Driver.main(Driver.scala:205)
at dotty.tools.dotc.Main.main(Main.scala)
Expectation
This code should not cause the compiler to throw an exception.
The Comparable trait is defined as the Comparable<T> interface in Java, with its only method being public int compareTo(T o);, so the code above would be expected to be a correct implementation of the trait (assuming we were to provide an actual implementation).
Ever since explicit nulls have been enabled, the error occurs when compiling the following code with both
-Ysafe-init
and-Yexplicit-nulls
.Compiler version
3.1.2-RC1
Minimized code
Output
Expectation
This code should not cause the compiler to throw an exception.
The
Comparable
trait is defined as theComparable<T>
interface in Java, with its only method beingpublic int compareTo(T o);
, so the code above would be expected to be a correct implementation of the trait (assuming we were to provide an actual implementation).@olhotak @liufengyun
The text was updated successfully, but these errors were encountered: