-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
minimized code
package mypkg
object Container {
class StringExtras(val s: String) extends AnyVal {
def op(item: Int): Int = ???
}
}
trait Container {
import Container._
implicit def mkStringExtras(s: String): StringExtras = new StringExtras(s)
}
In another file in src/test/scala
directory:
package mypkg
class SimpleTest extends Container {
"foo".op(5)
}
The problem goes away if I rename the trait from Container
to anything else. It appears to be related to the trait and the companion object having the same name.
Stack trace
error] assertion failed: no extension method found for:
[error]
[error] method op:(item: Int): Int with signature Signature(List(scala.Int),scala.Int) in <none>
[error]
[error] Candidates:
[error]
[error]
[error]
[error] Candidates (signatures normalized):
[error]
[error]
[error]
[error] Eligible Names: op$extension
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
[error] dotty.tools.dotc.transform.ExtensionMethods$.extensionMethod$$anonfun$1(ExtensionMethods.scala:226)
[error] dotty.tools.dotc.core.Phases.atPhase$$anonfun$1(Phases.scala:35)
[error] dotty.tools.dotc.core.Periods.atPhase(Periods.scala:25)
[error] dotty.tools.dotc.core.Phases.atPhase(Phases.scala:35)
[error] dotty.tools.dotc.core.Contexts$Context.atPhase(Contexts.scala:71)
[error] dotty.tools.dotc.transform.ExtensionMethods$.extensionMethod(ExtensionMethods.scala:241)
[error] dotty.tools.dotc.transform.VCInlineMethods.rewire(VCInlineMethods.scala:68)
[error] dotty.tools.dotc.transform.VCInlineMethods.rewireIfNeeded(VCInlineMethods.scala:95)
[error] dotty.tools.dotc.transform.VCInlineMethods.transformApply(VCInlineMethods.scala:105)
[error] dotty.tools.dotc.transform.MegaPhase.goApply(MegaPhase.scala:611)
[error] dotty.tools.dotc.transform.MegaPhase.goApply(MegaPhase.scala:612)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:272)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
[error] dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:406)
[error] dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
[error] scala.collection.immutable.List.mapConserve(List.scala:179)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
[error] dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:404)
[error] dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:409)
[error] scala.collection.immutable.List.mapConserve(List.scala:179)
[error] dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
[error] dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
[error] dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:415)
[error] dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:427)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:316)
[error] scala.collection.immutable.List.map(List.scala:286)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:318)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:158)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)