Skip to content

Inline recursive definition causes an assertion error #9309

@sir-wabbit

Description

@sir-wabbit

Minimized code

// AE-c98b423f3220dbf7a6a1802763d4853d0dc3e4d2
case class Foo(foo: Int) {
  inline def foo = (foo)
}

Output (click arrow to expand)

-- [E044] Cyclic Error: test.scala:2:19 ----------------------------------------
2 |  inline def foo = (foo)
  |                   ^
  |                   Overloaded or recursive method foo needs return type

longer explanation available when compiling with `-explain`
exception occurred while typechecking test.scala
exception occurred while compiling test.scala
java.lang.AssertionError: assertion failed: foo class dotty.tools.dotc.ast.Trees$Ident 1035 while compiling test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: foo class dotty.tools.dotc.ast.Trees$Ident 1035
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.typer.ReTyper.assertTyped(ReTyper.scala:28)
	at dotty.tools.dotc.typer.ReTyper.promote(ReTyper.scala:32)
	at dotty.tools.dotc.typer.ReTyper.typedIdent(ReTyper.scala:37)
	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedIdent$$anonfun$1(Inliner.scala:1195)
	at dotty.tools.dotc.ast.Trees$Tree.orElse(Trees.scala:186)
	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedIdent(Inliner.scala:1195)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2356)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2446)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2432)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2447)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:60)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2392)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2447)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.Inliner.op$1(Inliner.scala:738)
	at dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:754)
	at dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:127)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3188)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3295)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3526)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2850)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2851)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1362)
	at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1352)
	at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1362)
	at dotty.tools.dotc.typer.Namer.rhsType$2(Namer.scala:1494)
	at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1505)
	at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1506)
	at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1517)
	at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1525)
	at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1610)
	at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:824)
	at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:941)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:852)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:259)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:188)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:190)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:445)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2329)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2354)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2446)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2547)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2595)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2045)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2375)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2379)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2446)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2547)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2595)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2171)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2419)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2447)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2513)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2522)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2525)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2639)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	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:85)
	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:333)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)
	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:190)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)
	at dotty.tools.dotc.Run.compileSources(Run.scala:142)
	at dotty.tools.dotc.Run.compile(Run.scala:124)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	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:202)
	at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions