Closed
Description
minimized code
package example
trait Show[-A]:
extension (a: A) def show: String
given (using rec: Show[String]): Show[String] = ??? // must be Show[String] as the argument
given (using rec: => Show[String]): Show[Option[String]] = ??? // must be byname argument
def test = Option("").show
Crash output (click arrow to expand)
[info] running (fork) dotty.tools.dotc.Main -classpath /Users/jamie/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar:/Users/jamie/Workspace/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.23/dotty-library_0.23-0.23.0-bin-SNAPSHOT.jar -d local local/Kernel.scala
exception occurred while typechecking local/Kernel.scala
exception occurred while compiling local/Kernel.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: dotty.tools.dotc.typer.Applications$ExtMethodApply@4c3 while compiling local/Kernel.scala
java.lang.AssertionError: assertion failed: dotty.tools.dotc.typer.Applications$ExtMethodApply@4c3
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldMoreCases(Trees.scala:1466)
at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1461)
at dotty.tools.dotc.ast.tpd$$anon$5.apply(tpd.scala:1041)
at dotty.tools.dotc.ast.tpd$$anon$5.apply(tpd.scala:1041)
at dotty.tools.dotc.ast.tpd$TreeOps$.existsSubTree$extension(tpd.scala:1043)
at dotty.tools.dotc.typer.SearchRoot.$anonfun$10$$anonfun$2(Implicits.scala:1916)
at scala.collection.immutable.List.exists(List.scala:367)
at dotty.tools.dotc.typer.SearchRoot.$anonfun$11(Implicits.scala:1916)
at scala.collection.StrictOptimizedIterableOps.$anonfun$partition$1(StrictOptimizedIterableOps.scala:34)
at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:553)
at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:551)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1274)
at scala.collection.StrictOptimizedIterableOps.partition(StrictOptimizedIterableOps.scala:34)
at scala.collection.StrictOptimizedIterableOps.partition$(StrictOptimizedIterableOps.scala:32)
at scala.collection.immutable.List.partition(List.scala:79)
at dotty.tools.dotc.typer.SearchRoot.prune$1(Implicits.scala:1916)
at dotty.tools.dotc.typer.SearchRoot.emitDictionary(Implicits.scala:1922)
at dotty.tools.dotc.typer.Implicits.op$1(Implicits.scala:1363)
at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1364)
at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:83)
at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:680)
at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:83)
at dotty.tools.dotc.typer.Implicits.viewExists(Implicits.scala:655)
at dotty.tools.dotc.typer.Typer.viewExists(Typer.scala:83)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.isCompatible(ProtoTypes.scala:37)
at dotty.tools.dotc.typer.Typer.isCompatible(Typer.scala:83)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:81)
at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:83)
at dotty.tools.dotc.typer.ProtoTypes$Compatibility.constrainResult(ProtoTypes.scala:102)
at dotty.tools.dotc.typer.Typer.constrainResult(Typer.scala:83)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:345)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:690)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:792)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:866)
at dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6(Applications.scala:927)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:938)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:973)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2151)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:489)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:513)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2131)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:340)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:296)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:341)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$Application.$anonfun$4$$anonfun$1(Applications.scala:590)
at scala.collection.immutable.List.map(List.scala:219)
at dotty.tools.dotc.typer.Applications$Application.$anonfun$2(Applications.scala:590)
at dotty.tools.dotc.typer.Applications.harmonic(Applications.scala:1940)
at dotty.tools.dotc.typer.Typer.harmonic(Typer.scala:83)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:590)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:690)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:792)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:866)
at dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6(Applications.scala:927)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:938)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:973)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2151)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2194)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:340)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:296)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:341)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:793)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:529)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:598)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:690)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:792)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:866)
at dotty.tools.dotc.typer.Applications.realApply$7$$anonfun$6(Applications.scala:927)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2375)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:938)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:973)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2151)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1679)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2138)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1812)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2141)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2208)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2281)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2325)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1938)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2182)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2209)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2247)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2256)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2259)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2367)
at dotty.tools.dotc.typer.FrontEnd.liftedTree1$2(FrontEnd.scala:78)
at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:83)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:84)
at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:305)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:167)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:177)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:185)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
at dotty.tools.dotc.Run.compileUnits(Run.scala:192)
at dotty.tools.dotc.Run.compileSources(Run.scala:129)
at dotty.tools.dotc.Run.compile(Run.scala:112)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:36)
at dotty.tools.dotc.Driver.process(Driver.scala:189)
at dotty.tools.dotc.Driver.process(Driver.scala:158)
at dotty.tools.dotc.Driver.process(Driver.scala:170)
at dotty.tools.dotc.Driver.main(Driver.scala:197)
at dotty.tools.dotc.Main.main(Main.scala)