Description
minimized code
val a = List[1]()
It looks like it is caused by the interaction of varargs and literals, this fails in the same way:
def foo[A](as: A*): Int = ???
val a = foo[1]()
Stack trace
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:514)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:327)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:602)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:694)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:796)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:870)
at dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:923)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2298)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:934)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:969)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:82)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2099)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2157)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$3(ProtoTypes.scala:326)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:290)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:326)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:602)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:354)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:694)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:796)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:870)
at dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:923)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2298)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:934)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:969)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:82)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2099)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2157)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2290)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1640)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$2$$anonfun$1(TreeChecker.scala:431)
at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:168)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$1(TreeChecker.scala:434)
at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:168)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:435)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2086)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2156)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2232)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2276)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:475)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1771)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:415)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2089)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2156)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2232)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2276)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:475)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1890)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2130)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2157)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:301)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2193)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2205)
at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:286)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2290)
at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:121)
at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:94)
at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
at scala.collection.immutable.List.map(List.scala:219)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:161)
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:171)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:179)
at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:65)
at dotty.tools.dotc.Run.compileUnits(Run.scala:186)
at dotty.tools.dotc.Run.compileSources(Run.scala:123)
at dotty.tools.dotc.Run.compile(Run.scala:106)
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)
Error message
```scala sbt:dotty> dotc testing/Test.scala -Ycheck:all [warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list [info] Running (fork) dotty.tools.dotc.Main -classpath /Users/akonovalov/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.1.jar:/Users/akonovalov/Documents/projects/dotty-fork/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.21/dotty-library_0.21-0.21.0-bin-SNAPSHOT.jar testing/Test.scala -Ycheck:all checking testing/Test.scala after phase frontend checking testing/Test.scala after phase inlinedPositions checking testing/Test.scala after phase staging checking testing/Test.scala after phase posttyper checking testing/Test.scala after phase pickler checking testing/Test.scala after phase reifyQuotes checking testing/Test.scala after phase MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, completeJavaEnums} checking testing/Test.scala after phase MegaPhase{checkStatic, elimRepeated, expandSAMs, protectedAccessors, extmethods, cacheAliasImplicits, shortcutImplicits, byNameClosures, hoistSuperArgs, classOf, refchecks} checking testing/Test.scala after phase MegaPhase{elimOpaque, tryCatchPatterns, patternMatcher, explicitOuter, explicitSelf, stringInterpolatorOpt, crossCast} checking testing/Test.scala after phase MegaPhase{pruneErasedDefs, vcInlineMethods, seqLiterals, intercepted, getters, elimByName, collectNullableFields, elimOuterSelect, augmentScala2Traits, resolveSuper, functionXXLForwarders, genericTuples, arrayConstructors} exception while typing scala.runtime.ScalaRunTime.wrapIntArray([ : (1 : Int)]) of class class dotty.tools.dotc.ast.Trees$Apply # 1346 exception while typing foo[(1 : Int)](scala.runtime.ScalaRunTime.wrapIntArray([ : (1 : Int)])) of class class dotty.tools.dotc.ast.Trees$Apply # 1347 exception while typing def a: Int = foo[(1 : Int)](scala.runtime.ScalaRunTime.wrapIntArray([ : (1 : Int)])) of class class dotty.tools.dotc.ast.Trees$DefDef # 1350 exception while typing @scala.annotation.internal.SourceFile("testing/Test.scala") final module class Test$package$ () extends Object(), Serializable { private def writeReplace(): AnyRef = new scala.runtime.ModuleSerializationProxy(classOf[Test$package.type]) def foo[A](as: Seq[A] @Repeated): Int = ??? def a: Int = foo[(1 : Int)](scala.runtime.ScalaRunTime.wrapIntArray([ : (1 : Int)])) } of class class dotty.tools.dotc.ast.Trees$TypeDef # 1352 exception while typing package { final lazy module val Test$package: Test$package$ = new Test$package$() @scala.annotation.internal.SourceFile("testing/Test.scala") final module classTest$package$() extends Object(), Serializable {
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[Test$package.type])
def foo[A](as: Seq[A] @Repeated): Int = ???
def a: Int =
foo[(1 : Int)](scala.runtime.ScalaRunTime.wrapIntArray([ : (1 : Int)]))
}
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1353
*** error while checking testing/Test.scala after phase arrayConstructors ***
exception occurred while compiling testing/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Found: Array[(1 : Int)]
Required: Array[Int]
found: ??
expected: ??
tree = [ : (1 : Int)]
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:514)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:327)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:797)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:533)java.lang.AssertionError: assertion failed: Found: Array[(1 : Int)]
Required: Array[Int]
found: ??
expected: ??
tree = [ : (1 : Int)] while compiling testing/Test.scala
</details>