Skip to content

Inline crashing compiler after cyclic reference detected. #1568

Closed
@nicolasstucki

Description

@nicolasstucki
  inline def foo(n: Int) = foo(n)
tests/main.scala:7: error: cyclic reference involving method foo
  inline def foo(n: Int) = foo(n)
                           ^
exception occurred while typechecking foo.scala
exception occurred while compiling foo.scala
Exception in thread "main" dotty.tools.dotc.ast.Trees$UnAssignedTypeException: type of Ident(n) is not assigned
    at dotty.tools.dotc.ast.Trees$Tree.tpe(Trees.scala:93)
    at dotty.tools.dotc.ast.Trees$DenotingTree.denot(Trees.scala:226)
    at dotty.tools.dotc.ast.Trees$Tree.symbol(Trees.scala:144)
    at dotty.tools.dotc.typer.Inliner$addAccessors$2$.transform(Inliner.scala:143)
    at dotty.tools.dotc.ast.Trees$Instance$TreeMap$$anonfun$transform$2.apply(Trees.scala:1161)
    at dotty.tools.dotc.ast.Trees$Instance$TreeMap$$anonfun$transform$2.apply(Trees.scala:1161)
    at scala.collection.immutable.List.loop$1(List.scala:173)
    at scala.collection.immutable.List.mapConserve(List.scala:189)
    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1161)
    at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1080)
    at dotty.tools.dotc.typer.Inliner$addAccessors$2$.transform(Inliner.scala:141)
    at dotty.tools.dotc.typer.Inliner$.dotty$tools$dotc$typer$Inliner$$makeInlineable(Inliner.scala:171)
    at dotty.tools.dotc.typer.Inliner$$anonfun$registerInlineInfo$1.apply(Inliner.scala:194)
    at dotty.tools.dotc.typer.Inliner$$anonfun$registerInlineInfo$1.apply(Inliner.scala:191)
    at dotty.tools.dotc.core.Annotations$LazyBodyAnnotation.tree(Annotations.scala:70)
    at dotty.tools.dotc.typer.Inliner$.bodyAndAccessors(Inliner.scala:207)
    at dotty.tools.dotc.typer.Inliner$.bodyToInline(Inliner.scala:216)
    at dotty.tools.dotc.typer.Typer.inlineExpansion(Typer.scala:1538)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1516)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1530)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1248)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1196)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
    at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1196)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1432)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1480)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1492)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1490)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:154)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1490)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1514)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1530)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1348)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1339)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
    at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1339)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1470)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1482)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1492)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1490)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:154)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1490)
    at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1542)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:50)
    at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:24)
    at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:48)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:72)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:72)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:72)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:71)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:68)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:68)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:62)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:62)
    at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:76)
    at dotty.tools.dotc.Run.compileUnits(Run.scala:62)
    at dotty.tools.dotc.Run.compileSources(Run.scala:59)
    at dotty.tools.dotc.Run.compile(Run.scala:43)
    at dotty.tools.dotc.Driver.doCompile(Driver.scala:26)
    at dotty.tools.dotc.Driver.process(Driver.scala:124)
    at dotty.tools.dotc.Driver.process(Driver.scala:93)
    at dotty.tools.dotc.Driver.process(Driver.scala:105)
    at dotty.tools.dotc.Driver.main(Driver.scala:132)
    at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions