Skip to content

Assertion failed when inserting implicit args to NamedArg #8925

@kubukoz

Description

@kubukoz

Minimized code

trait Parent {
  type Child
}

object Demo {
  def params(arr: Int): Int = ???

  def parametersOf[Parent, T]()(using m: String): Int = 0
  
  def combineInternal(using p: Parent): Int = {
    //this implicit needs to be available
    implicit val s: String = ""

    //parameter needs to be named
    params(arr = parametersOf[Parent, p.Child])
  }
}

Output (click arrow to expand)

[info] exception occurred while typechecking /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/magnoliadotty.scala
[info] exception occurred while compiling /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/interface.scala, /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/magnolia.scala, /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/magnoliadotty.scala
java.lang.AssertionError: assertion failed while compiling /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/interface.scala, /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/magnolia.scala, /Users/kubukoz/IdeaProjects/magnolia/core/shared/src/main/scala/magnoliadotty.scala
[error] ## Exception when compiling 3 sources to /Users/kubukoz/IdeaProjects/magnolia/core/jvm/target/scala-0.25/classes
[error] java.lang.AssertionError: assertion failed
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
[error] dotty.tools.dotc.ast.tpd$.Apply(tpd.scala:45)
[error] dotty.tools.dotc.typer.Typer.addImplicitArgs$3(Typer.scala:2987)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$2(Typer.scala:2996)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3169)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3399)
[error] dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2778)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2779)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:339)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:798)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:798)
[error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)
[error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:602)
[error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:358)
[error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:695)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:797)
[error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1002)
[error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:84)
[error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:867)
[error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:928)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2575)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:939)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:977)
[error] dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:84)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2346)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2405)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2444)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2453)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2456)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2567)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:853)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2354)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2405)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2444)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2453)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2456)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2567)
[error] dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1868)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2323)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2444)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2453)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2456)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2478)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2523)
[error] dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2004)
[error] dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2334)
[error] dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2338)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2404)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2444)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2453)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2456)
[error] dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2478)
[error] dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2523)
[error] dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2130)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2377)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2405)
[error] dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2444)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2453)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2456)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2567)
[error] dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
[error] dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
[error] dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.immutable.List.foreach(List.scala:333)
[error] dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:165)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:175)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:183)
[error] dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:190)
[error] dotty.tools.dotc.Run.compileSources(Run.scala:127)
[error] dotty.tools.dotc.Run.compile(Run.scala:110)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
[error] dotty.tools.dotc.Driver.process(Driver.scala:194)
[error] dotty.tools.dotc.Main.process(Main.scala)
[error] xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
[error] xsbt.CompilerInterface.run(CompilerInterface.java:41)
[error] sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
[error] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] java.lang.reflect.Method.invoke(Method.java:498)
[error] sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
[error] sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
[error] sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1762)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1735)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] sbt.Execute.work(Execute.scala:290)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions