-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
itype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
The compiler crashes when resolving overloaded methods where the argument type has mixed wildcard and concrete type arguments on an invariant type.
Regression introduced by #24669
Reported by @tgodzik in scala#695 thanks!
Compiler version
3.8.0
Minimized code
def bar[V](a: java.util.Map[String, ? <: V]): Int = 1
def bar[V](a: java.util.Map[String, V], ints: Int*): Int = 2
val arg: java.util.Map[String, ? <: Object] = new java.util.HashMap()
bar(arg) // crashOutput (click arrow to expand)
(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String),TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String)) (of class scala.Tuple2)
at dotty.tools.dotc.typer.Applications$TestApplication.wildcardArgOK$1$$anonfun$1(Applications.scala:902)
at scala.collection.LazyZip2.forall$$anonfun$1(LazyZipOps.scala:108)
at scala.collection.LazyZip2.exists(LazyZipOps.scala:103)
at scala.collection.LazyZip2.forall(LazyZipOps.scala:108)
at dotty.tools.dotc.typer.Applications$TestApplication.wildcardArgOK$1(Applications.scala:901)
at dotty.tools.dotc.typer.Applications$TestApplication.argOK(Applications.scala:907)
at dotty.tools.dotc.typer.Applications$TestApplication.addArg(Applications.scala:937)
...
Details
(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String),TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String)) (of class scala.Tuple2)
at dotty.tools.dotc.typer.Applications$TestApplication.wildcardArgOK$1$$anonfun$1(Applications.scala:902)
at scala.collection.LazyZip2.forall$$anonfun$1(LazyZipOps.scala:108)
at scala.collection.LazyZip2.exists(LazyZipOps.scala:103)
at scala.collection.LazyZip2.forall(LazyZipOps.scala:108)
at dotty.tools.dotc.typer.Applications$TestApplication.wildcardArgOK$1(Applications.scala:901)
at dotty.tools.dotc.typer.Applications$TestApplication.argOK(Applications.scala:907)
at dotty.tools.dotc.typer.Applications$TestApplication.addArg(Applications.scala:937)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:750)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:836)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:629)
at dotty.tools.dotc.typer.Applications$TestApplication.<init>(Applications.scala:945)
at dotty.tools.dotc.typer.Applications$ApplicableToTypes.<init>(Applications.scala:964)
at dotty.tools.dotc.typer.Applications.isApplicableMethodRef(Applications.scala:1870)
at dotty.tools.dotc.typer.Applications.isApplicableMethodRef$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.isApplicableMethodRef(Typer.scala:163)
at dotty.tools.dotc.typer.Applications.isAsGood$1(Applications.scala:2046)
at dotty.tools.dotc.typer.Applications.compareWithTypes$1(Applications.scala:2201)
at dotty.tools.dotc.typer.Applications.compare(Applications.scala:2233)
at dotty.tools.dotc.typer.Applications.compare$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.compare(Typer.scala:163)
at dotty.tools.dotc.typer.Applications.narrowMostSpecific(Applications.scala:2249)
at dotty.tools.dotc.typer.Applications.narrowMostSpecific$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.narrowMostSpecific(Typer.scala:163)
at dotty.tools.dotc.typer.Applications.resolveOverloaded1(Applications.scala:2592)
at dotty.tools.dotc.typer.Applications.resolve$1(Applications.scala:2335)
at dotty.tools.dotc.typer.Applications.resolveOverloaded(Applications.scala:2376)
at dotty.tools.dotc.typer.Applications.resolveOverloaded$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.resolveOverloaded(Typer.scala:163)
at dotty.tools.dotc.typer.Typer.adaptOverloaded$1(Typer.scala:4394)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:5095)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:4355)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1181)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1408)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:163)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3793)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3887)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:1076)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:1130)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3768)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3886)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1181)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1408)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:163)
at dotty.tools.dotc.typer.Typer.typedInfixOp(Typer.scala:3664)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3834)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3887)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:563)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:486)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:565)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1137)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1137)
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:750)
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:836)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:629)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:984)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:1136)
at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1434)
at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:163)
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1224)
at dotty.tools.dotc.typer.Applications.$anonfun$17(Applications.scala:1340)
at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:136)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1359)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1408)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:489)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:163)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3793)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3887)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1544)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3801)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3887)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.Typer.$anonfun$69(Typer.scala:3136)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:256)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:3136)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3775)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3886)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:4001)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:4047)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3439)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3781)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3785)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3886)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:4001)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:4047)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3574)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3827)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3887)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3974)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3979)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:4090)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:533)
at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:495)
at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:599)
at scala.collection.immutable.List.prependedAll(List.scala:156)
at scala.collection.immutable.List$.from(List.scala:682)
at scala.collection.immutable.List$.from(List.scala:682)
at scala.collection.IterableOps$WithFilter.map(Iterable.scala:911)
at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:380)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1327)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:373)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:420)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:420)
at scala.Function0.apply$mcV$sp(Function0.scala:43)
at dotty.tools.dotc.Run.showProgress(Run.scala:482)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:420)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:432)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
at dotty.tools.dotc.Run.compileUnits(Run.scala:432)
at dotty.tools.dotc.Run.compileSources(Run.scala:319)
at dotty.tools.dotc.Run.compile(Run.scala:304)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
at dotty.tools.dotc.Driver.process(Driver.scala:213)
at dotty.tools.dotc.Driver.process(Driver.scala:181)
at dotty.tools.vulpix.ParallelTesting$Test.compile(ParallelTesting.scala:566)
at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1$$anonfun$1(ParallelTesting.scala:263)
at scala.collection.immutable.List.map(List.scala:244)
at dotty.tools.vulpix.ParallelTesting$CompilationLogic.compileTestSource$$anonfun$1(ParallelTesting.scala:261)
at scala.util.Try$.apply(Try.scala:218)
at dotty.tools.vulpix.ParallelTesting$CompilationLogic.dotty$tools$vulpix$ParallelTesting$CompilationLogic$$compileTestSource(ParallelTesting.scala:266)
at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$1(ParallelTesting.scala:297)
at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource$$anonfun$adapted$1(ParallelTesting.scala:300)
at scala.Function0.apply$mcV$sp(Function0.scala:43)
at dotty.tools.vulpix.ParallelTesting$Test.tryCompile(ParallelTesting.scala:484)
at dotty.tools.vulpix.ParallelTesting$$anon$3.checkTestSource(ParallelTesting.scala:300)
at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run(ParallelTesting.scala:380)
at dotty.tools.vulpix.ParallelTesting$Test$LoggedRunnable.run$(ParallelTesting.scala:362)
at dotty.tools.vulpix.ParallelTesting$$anon$3.run(ParallelTesting.scala:295)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1193)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1666)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1633)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)Metadata
Metadata
Assignees
Labels
itype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label