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
This is not overloading issue, but I have no better word for it. If one defines two methods with the same arguments but one with implicit and the other one without, the compiler will crash.
classA {
deffoo(i: Int):Int= i
deffoo(impliciti: Int):Int= i
}
java.lang.AssertionError: assertion failed: data race? overwriting symbol of type ((i: Int)Int)(A.this.foo),
long form = TermRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),A)),foo)/withSig(Signature(List(scala.Int),scala.Int)) of class class dotty.tools.dotc.core.Types$TermRefWithSignature,
last sym id = 3803, new sym id = 3804,
last owner = class A, new owner = class A,
period = frontend at run 2
at scala.Predef$.assert(Predef.scala:165)
at dotty.tools.dotc.core.Types$NamedType.checkSymAssign(Types.scala:1506)
at dotty.tools.dotc.core.Types$NamedType.setDenot(Types.scala:1541)
at dotty.tools.dotc.core.Types$NamedType.withDenot(Types.scala:1534)
at dotty.tools.dotc.core.Types$TermRef$.withSigAndDenot(Types.scala:1942)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.termRefWithSig(SymDenotations.scala:1105)
at dotty.tools.dotc.typer.TypeAssigner$$anonfun$assignType$5.apply(TypeAssigner.scala:498)
at dotty.tools.dotc.typer.TypeAssigner$$anonfun$assignType$5.apply(TypeAssigner.scala:498)
at dotty.tools.dotc.core.Types$Type.orElse(Types.scala:99)
at dotty.tools.dotc.typer.TypeAssigner$class.assignType(TypeAssigner.scala:498)
at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:64)
at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1243)
at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1214)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1214)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1505)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1562)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1581)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1579)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1579)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1603)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1623)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1315)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1261)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1261)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1508)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1562)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1581)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1579)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1579)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1603)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1623)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1423)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1410)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1410)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1547)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1563)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1581)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1579)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1579)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1635)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:64)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:32)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:62)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:93)
at scala.collection.immutable.List.foreach(List.scala:381)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:93)
The text was updated successfully, but these errors were encountered:
That crash is only produced by -Yno-double-bindings, and it is inevitable. Without the option we get:
-- Error: i2002.scala ----------------------------------------------------------
3 | def foo(implicit i: Int): Int = i
| ^
| method foo is already defined as method foo: (i: Int)Int
| (the definitions have matching type signatures)
… with <:<
Implicit and non-implicit functions are incomparable with <:<, but are
treated as equivalent with `matches`. This means implicit and non-implicit
functions of the same types override each other, but RefChecks will
give an error because their types are not subtypes.
Also contains a test for scala#2002.
This is not overloading issue, but I have no better word for it. If one defines two methods with the same arguments but one with implicit and the other one without, the compiler will crash.
The text was updated successfully, but these errors were encountered: