File: t8359-closelim-crash.scala

package info (click to toggle)
scala 2.11.12-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 62,924 kB
  • sloc: javascript: 28,808; java: 13,415; xml: 3,135; sh: 1,620; python: 756; makefile: 38; awk: 36; ansic: 6
file content (23 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package test

// This is a minimization of code that crashed the compiler during bootstrapping
// in the first iteration of https://github.com/scala/scala/pull/4373, the PR
// that adjusted the order of free and declared params in LambdaLift.

// Was:
//  java.lang.AssertionError: assertion failed:
//  Record Record(<$anon: Function1>,Map(value a$1 -> Deref(LocalVar(value b)))) does not contain a field value b$1
// at scala.tools.nsc.Global.assert(Global.scala:262)
// at scala.tools.nsc.backend.icode.analysis.CopyPropagation$copyLattice$State.getFieldNonRecordValue(CopyPropagation.scala:113)
// at scala.tools.nsc.backend.icode.analysis.CopyPropagation$copyLattice$State.getFieldNonRecordValue(CopyPropagation.scala:122)
// at scala.tools.nsc.backend.opt.ClosureElimination$ClosureElim$$anonfun$analyzeMethod$1$$anonfun$apply$2.replaceFieldAccess$1(ClosureElimination.scala:124)
class Typer {
  def bar(a: Boolean, b: Boolean): Unit = {
    @inline
    def baz(): Unit = {
      ((_: Any) => (Typer.this, a, b)).apply("")
    }
    ((_: Any) => baz()).apply("")
  }
}