Closed
Description
Compiler version
Tested on 3.2.0-RC1-bin-SNAPSHOT-git-47fa175, 3.1.3-RC5, and 3.0.2.
Minimized code
class C()
object C {
val c = apply()
}
The code compiles if C.apply()
is used instead, in which case tree
is Select(Ident(C),apply)
instead of Ident(apply)
.
Output (click arrow to expand)
scala.MatchError: Ident(apply) (of class dotty.tools.dotc.ast.Trees$Ident) while compiling /tmp/test.scala
Exception in thread "main" scala.MatchError: Ident(apply) (of class dotty.tools.dotc.ast.Trees$Ident)
at dotty.tools.dotc.typer.Typer.newExpr$1(Typer.scala:3985)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4030)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3369)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2986)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2990)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3106)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:898)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1040)
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:327)
at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:117)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2858)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2921)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2986)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2990)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3106)
at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1618)
at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1608)
at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1618)
at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1866)
at dotty.tools.dotc.typer.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:248)
at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1866)
at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1874)
at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1892)
at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1893)
at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1904)
at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1657)
at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1664)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:782)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:921)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:809)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:171)
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:373)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2799)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2824)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2920)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2986)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2990)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3012)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3062)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2500)
at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2846)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2850)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2920)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2986)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2990)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3012)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3062)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2629)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2891)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2921)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2986)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2990)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3106)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:43)
at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:50)
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:417)
at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:50)
at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:84)
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:84)
at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:225)
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:1328)
at dotty.tools.dotc.Run.runPhases$1(Run.scala:236)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:244)
at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:253)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
at dotty.tools.dotc.Run.compileUnits(Run.scala:253)
at dotty.tools.dotc.Run.compileSources(Run.scala:186)
at dotty.tools.dotc.Run.compile(Run.scala:170)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
at dotty.tools.dotc.Driver.process(Driver.scala:195)
at dotty.tools.dotc.Driver.process(Driver.scala:163)
at dotty.tools.dotc.Driver.process(Driver.scala:175)
at dotty.tools.dotc.Driver.main(Driver.scala:205)
at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)