Skip to content

Compiler crash on call by name parameters used in inner classes. #2188

Closed
@nicolasstucki

Description

@nicolasstucki
class Fill(elem: => Int) {
  class Iter {
    def next(): Int = elem
  }
}

fails with

*** error while checking /Users/nicolasstucki/GitHub/dotty/compiler/../tests/run-wip/blabla.scala after phase arrayConstructors ***
java.lang.AssertionError: assertion failed: found:    (() => Int)(Fill.this.elem)
required: Int


tree = Fill.this.elem
	at scala.Predef$.assert(Predef.scala:165)
	at dotty.tools.dotc.transform.TreeChecker$Checker.adapt(TreeChecker.scala:459)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1596)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1594)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1594)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:254)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1650)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1245)
	at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:1227)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1227)
	at dotty.tools.dotc.transform.TreeChecker$Checker.dotty$tools$dotc$transform$TreeChecker$Checker$$super$typedDefDef(TreeChecker.scala:415)
...

This code is a minimization of an issue found while trying to compile the collection strawman with dotty (original code).

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