Skip to content

Compiler crash: "failure to construct path" #3917

Closed
@allanrenucci

Description

@allanrenucci
class Hello {
  var verbose = false
}

object Main extends Hello {
  def test = {
    verbose = true
  }
}
dotc tests/allan/Test.scala
exception while typing Hello.this of class class dotty.tools.dotc.ast.Trees$This # 227
exception while typing Hello.this.verbose_= of class class dotty.tools.dotc.ast.Trees$Select # 228
exception while typing Hello.this.verbose_=(true) of class class dotty.tools.dotc.ast.Trees$Apply # 229
exception while typing {
  Hello.this.verbose_=(true)
} of class class dotty.tools.dotc.ast.Trees$Block # 230
exception while typing def test: Unit = 
  {
    Hello.this.verbose_=(true)
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 231
exception while typing @scala.annotation.internal.SourceFile("tests/allan/Test.scala") final module 
  class
 Main() extends Hello() { 
  def test: Unit = 
    {
      Hello.this.verbose_=(true)
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 233
exception while typing package <empty> {
  @scala.annotation.internal.SourceFile("tests/allan/Test.scala") class Hello()
     extends
   Object() { 
    <accessor> def verbose: Boolean = false
    <accessor> def verbose_=(x$1: Boolean): Unit = ()
  }
  final lazy module val Main: Main = new Main()
  @scala.annotation.internal.SourceFile("tests/allan/Test.scala") final module 
    class
   Main() extends Hello() { 
    def test: Unit = 
      {
        Hello.this.verbose_=(true)
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 234
exception occurred while compiling tests/allan/Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: failure to construct path from method test/object Main/package <empty>/package <root> to `this` of class Hello;
object Main does not have an outer accessor
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:36)
	at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:386)
	at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:392)
	at dotty.tools.dotc.transform.Erasure$Typer.typedThis(Erasure.scala:454)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1721)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1770)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:442)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1701)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1769)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1844)
	at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:492)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1720)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1770)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1844)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:646)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1727)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1770)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1844)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1381)
	at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:577)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1708)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1769)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1809)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1832)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:672)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1422)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1711)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1769)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1809)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1832)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:672)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1593)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1751)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1770)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:94)
	at dotty.tools.dotc.typer.Typer.op1$2(Typer.scala:1787)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1783)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1844)
	at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:99)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:293)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:295)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:123)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:136)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:141)
	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:88)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:143)
	at dotty.tools.dotc.Run.compileSources(Run.scala:94)
	at dotty.tools.dotc.Run.compile(Run.scala:78)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:29)
	at dotty.tools.dotc.Driver.process(Driver.scala:127)
	at dotty.tools.dotc.Driver.process(Driver.scala:96)
	at dotty.tools.dotc.Driver.process(Driver.scala:108)
	at dotty.tools.dotc.Driver.main(Driver.scala:135)
	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