Skip to content

Compiler crash when normalizing constructor of JUnit exception #7990

Closed
@gabro

Description

@gabro

minimized code

@main def main = org.junit.AssumptionViolatedException("error")

Here's a runnable Scastie: https://scastie.scala-lang.org/wkjlmlHKRkCHKsERn5BO3A

Stack trace
scala.MatchError: PolyType(List(T), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), JavaMethodType(List(x$0, x$1, x$2), List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeParamRef(T), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class hamcrest)),trait Matcher),List(TypeParamRef(T)))), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Unit))) (of class dotty.tools.dotc.core.Types$PolyType)
	at dotty.tools.dotc.core.classfile.ClassfileParser$$anon$1.normalizeConstructorInfo$1(ClassfileParser.scala:276)
	at dotty.tools.dotc.core.classfile.ClassfileParser$$anon$1.complete(ClassfileParser.scala:286)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:258)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1190)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1141)
	at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:132)
	at dotty.tools.dotc.core.Denotations$DenotUnion.computeAsSeenFrom(Denotations.scala:1308)
	at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:132)
	at dotty.tools.dotc.core.Denotations$DenotUnion.computeAsSeenFrom(Denotations.scala:1308)
	at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:132)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1851)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:572)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:733)
	at dotty.tools.dotc.typer.TypeAssigner.selectionType(TypeAssigner.scala:258)
	at dotty.tools.dotc.typer.Typer.selectionType(Typer.scala:83)
	at dotty.tools.dotc.typer.TypeAssigner.accessibleSelectionType(TypeAssigner.scala:294)
	at dotty.tools.dotc.typer.Typer.accessibleSelectionType(Typer.scala:83)
	at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:325)
	at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:465)
	at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:478)
	at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:502)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2099)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
	at dotty.tools.dotc.typer.Applications.typedFunPart$$anonfun$1(Applications.scala:822)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2341)
	at dotty.tools.dotc.typer.Applications.typedFunPart(Applications.scala:830)
	at dotty.tools.dotc.typer.Typer.typedFunPart(Typer.scala:83)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:841)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:970)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:83)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2119)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedThrow(Typer.scala:1307)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2136)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1263)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1253)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1263)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1397)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1408)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1409)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1420)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1428)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1500)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:815)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:935)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:843)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:258)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:185)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:187)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:398)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2071)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2096)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1784)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2109)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2176)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2247)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2291)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1910)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2150)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2177)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2213)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2225)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2333)
	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: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.Main.process(Main.scala)
	at xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:69)
	at xsbt.CompilerInterface.run(CompilerInterface.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
	at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
	at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
	at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
	at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
	at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
	at sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
	at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
	at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1762)
	at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1735)
	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
	at sbt.std.Transform$$anon$4.work(Transform.scala:67)
	at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
	at sbt.Execute.work(Execute.scala:290)
	at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at 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