Closed
Description
Compiling a minimized example with scala 3.3.1:
class Test {
def test(s: String): Unit = {
if (s == null) {
return
}
case class XXX()
}
}
results in
scala.MatchError: TypeDef(XXX,Template(DefDef(<init>,List(List()),TypeTree,EmptyTree),List(Select(Select(Ident(_root_),scala),Product), Select(Select(Ident(_root_),scala),Serializable)),ValDef(_,EmptyTree,EmptyTree),List(DefDef(copy,List(List()),TypeTree,Apply(Select(New(TypeTree),<init>),List()))))) (of class dotty.tools.dotc.ast.Trees$TypeDef) while typechecking /tmp/a/test.scala
exception occurred while typechecking /tmp/a/test.scala
exception occurred while compiling List(/tmp/a/test.scala)
An unhandled exception was thrown in the compiler.
Please file a crash report here:
https://github.com/lampepfl/dotty/issues/new/choose
while compiling: <no file>
during phase: <no phase>
mode: Mode(ImplicitsEnabled)
library version: version 2.13.10
compiler version: version 3.3.1
settings: -classpath /home/user/opt/scala3/lib/scala-library-2.13.10.jar:/home/user/opt/scala3/lib/scala3-library_3-3.3.1.jar:/home/user/opt/scala3/lib/scala-asm-9.5.0-scala-1.jar:/home/user/opt/scala3/lib/compiler-interface-1.3.5.jar:/home/user/opt/scala3/lib/scala3-interfaces-3.3.1.jar:/home/user/opt/scala3/lib/scala3-compiler_3-3.3.1.jar:/home/user/opt/scala3/lib/tasty-core_3-3.3.1.jar:/home/user/opt/scala3/lib/scala3-staging_3-3.3.1.jar:/home/user/opt/scala3/lib/scala3-tasty-inspector_3-3.3.1.jar:/home/user/opt/scala3/lib/jline-reader-3.19.0.jar:/home/user/opt/scala3/lib/jline-terminal-3.19.0.jar:/home/user/opt/scala3/lib/jline-terminal-jna-3.19.0.jar:/home/user/opt/scala3/lib/jna-5.3.1.jar -d /tmp/scala3-scripting16613904917771917003
tree: EmptyTree
tree position: :<unknown>
tree type: <notype>
symbol: val <none>
call site: package <root> in module class <root>
== Source file context for tree position ==
Exception in thread "main" scala.MatchError: TypeDef(XXX,Template(DefDef(<init>,List(List()),TypeTree,EmptyTree),List(Select(Select(Ident(_root_),scala),Product), Select(Select(Ident(_root_),scala),Serializable)),ValDef(_,EmptyTree,EmptyTree),List(DefDef(copy,List(List()),TypeTree,Apply(Select(New(TypeTree),<init>),List()))))) (of class dotty.tools.dotc.ast.Trees$TypeDef)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:798)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:934)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:814)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:174)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2989)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3014)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1159)
at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1163)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3056)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
at dotty.tools.dotc.typer.Typer.$anonfun$57(Typer.scala:2486)
at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:243)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2486)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3024)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2669)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3036)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3040)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3111)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3210)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3256)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2812)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3081)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3112)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3184)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3188)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3300)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54)
at scala.Function0.apply$mcV$sp(Function0.scala:42)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:440)
at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:333)
at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
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:1321)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
at dotty.tools.dotc.Run.compileSources(Run.scala:194)
at dotty.tools.dotc.Run.compile(Run.scala:179)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
at dotty.tools.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:22)
at dotty.tools.scripting.Main$.process(Main.scala:45)
at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:250)
at dotty.tools.MainGenericRunner$.process(MainGenericRunner.scala:270)
at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:281)
at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)