Skip to content

Compiler crashes during HoistSuperArgs #3189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
allanrenucci opened this issue Sep 27, 2017 · 0 comments
Closed

Compiler crashes during HoistSuperArgs #3189

allanrenucci opened this issue Sep 27, 2017 · 0 comments

Comments

@allanrenucci
Copy link
Contributor

The following code snippet crashes the compiler

class Test[A](action: A => A) {
  def this() = this(a => a)
}
Stacktrace
exception while transforming @scala.annotation.internal.SourceFile("tests/allan/Test.scala") class Test[A](
  action: A => A
) extends Object() { 
  A
  private[this] val action: Test.this.A => Test.this.A
  def [A](): Unit = 
    {
      this[Test.this.A](
        {
          def $anonfun(a: Test.this.A): Test.this.A = a
          closure($anonfun)
        }
      )
      ()
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 131
exception while transforming package  {
  @scala.annotation.internal.SourceFile("tests/allan/Test.scala") class Test[A](
    action: A => A
  ) extends Object() { 
    A
    private[this] val action: Test.this.A => Test.this.A
    def [A](): Unit = 
      {
        this[Test.this.A](
          {
            def $anonfun(a: Test.this.A): Test.this.A = a
            closure($anonfun)
          }
        )
        ()
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 132

exception occurred while compiling tests/allan/Test.scala
Exception in thread "main" java.util.NoSuchElementException: key not found: type A
at scala.collection.immutable.Map$Map1.apply(Map.scala:108)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister$$anon$1.apply(HoistSuperArgs.scala:131)
at dotty.tools.dotc.core.Types$TypeMap.$anonfun$mapOver$2(Types.scala:3755)
at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3679)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs$1(Types.scala:3755)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3763)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister$$anon$1.apply(HoistSuperArgs.scala:134)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister$$anon$1.apply(HoistSuperArgs.scala:125)
at dotty.tools.dotc.ast.TreeTypeMap.mapType(TreeTypeMap.scala:62)
at dotty.tools.dotc.ast.TreeTypeMap.transform(TreeTypeMap.scala:89)
at dotty.tools.dotc.ast.TreeTypeMap.apply(TreeTypeMap.scala:140)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister.$anonfun$hoistSuperArg$5(HoistSuperArgs.scala:143)
at dotty.tools.dotc.ast.tpd$.polyDefDef(tpd.scala:209)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister.hoistSuperArg(HoistSuperArgs.scala:122)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister.$anonfun$hoistSuperArgsFromCall$1(HoistSuperArgs.scala:168)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:62)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:78)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister.hoistSuperArgsFromCall(HoistSuperArgs.scala:168)
at dotty.tools.dotc.transform.HoistSuperArgs$Hoister.hoistSuperArgsFromConstr(HoistSuperArgs.scala:179)
at dotty.tools.dotc.transform.HoistSuperArgs.$anonfun$transformTypeDef$1(HoistSuperArgs.scala:195)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:62)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:78)
at dotty.tools.dotc.transform.HoistSuperArgs.transformTypeDef(HoistSuperArgs.scala:195)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.goTypeDef(TreeTransform.scala:839)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transformNamed(TreeTransform.scala:986)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.$anonfun$transform$5(TreeTransform.scala:1184)
at dotty.tools.dotc.reporting.Reporting.traceIndented(Reporter.scala:140)
at dotty.tools.dotc.reporting.Reporting.traceIndented$(Reporter.scala:139)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transform(TreeTransform.scala:1177)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transformStat$1(TreeTransform.scala:1210)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.$anonfun$transformStats$2(TreeTransform.scala:1214)
at dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:62)
at dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:78)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transformStats(TreeTransform.scala:1214)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transformUnnamed(TreeTransform.scala:1164)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.$anonfun$transform$5(TreeTransform.scala:1185)
at dotty.tools.dotc.reporting.Reporting.traceIndented(Reporter.scala:140)
at dotty.tools.dotc.reporting.Reporting.traceIndented$(Reporter.scala:139)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.transform(TreeTransform.scala:1177)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.macroTransform(TreeTransform.scala:557)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.run(TreeTransform.scala:475)
at dotty.tools.dotc.core.Phases$Phase.$anonfun$runOn$1(Phases.scala:288)
at scala.collection.immutable.List.map(List.scala:283)
at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:286)
at dotty.tools.dotc.core.Phases$Phase.runOn$(Phases.scala:285)
at dotty.tools.dotc.transform.TreeTransforms$TreeTransformer.runOn(TreeTransform.scala:469)
at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:124)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:47)
at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:122)
at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:120)
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.$anonfun$compileUnits$1(Run.scala:120)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:86)
at dotty.tools.dotc.Run.compileUnits(Run.scala:108)
at dotty.tools.dotc.Run.compileSources(Run.scala:95)
at dotty.tools.dotc.Run.compile(Run.scala:79)
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)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1


@allanrenucci allanrenucci changed the title Compiler crash during HoistSuperArgs Compiler crashes during HoistSuperArgs Sep 27, 2017
This was referenced Sep 27, 2017
odersky added a commit that referenced this issue Sep 27, 2017
Fix #3189: Make TreeTypeMap in hoistSuperArgs more robust
odersky added a commit to dotty-staging/dotty that referenced this issue Sep 27, 2017
 - also rework previous test of scala#3189 to be a run test, just to make
   sure the problem is solved.
odersky added a commit to dotty-staging/dotty that referenced this issue Sep 29, 2017
 - also rework previous test of scala#3189 to be a run test, just to make
   sure the problem is solved.
allanrenucci pushed a commit to dotty-staging/dotty that referenced this issue Sep 29, 2017
 - also rework previous test of scala#3189 to be a run test, just to make
   sure the problem is solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant