blob: 49c9e2f2e5d82bb864d93303bd231386d8b4a16b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import scala.tools.partest._
import java.io.{Console => _, _}
object Test extends StoreReporterDirectTest {
override def extraSettings: String = List(
"-usejavacp",
"-Xfatal-warnings",
"-Ydelambdafy:method",
"-Xprint:delambdafy",
s"-d ${testOutput.path}"
) mkString " "
override def code = """package o
|package a {
| class C {
| def hihi = List(1,2).map(_ => "")
| }
|}
|package object a {
| def f = 1
|}
|""".stripMargin.trim
override def show(): Unit = {
val baos = new java.io.ByteArrayOutputStream()
Console.withOut(baos)(Console.withErr(baos)(compile()))
assert(!storeReporter.hasErrors, message = filteredInfos map (_.msg) mkString "; ")
val out = baos.toString("UTF-8")
// was 2 before the fix, the two PackageDefs for a would both contain the ClassDef for the closure
assert(out.lines.count(_ contains "def $anonfun$hihi$1(x$1: Int): String") == 1, out)
}
}
|