Skip to content

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

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
nicolasstucki opened this issue Apr 4, 2017 · 0 comments
Closed

Comments

@nicolasstucki
Copy link
Contributor

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).

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