diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t10009.scala | 6 | ||||
-rw-r--r-- | test/files/run/t10009.scala | 28 |
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/pos/t10009.scala b/test/files/pos/t10009.scala new file mode 100644 index 0000000000..7cd96f0f3d --- /dev/null +++ b/test/files/pos/t10009.scala @@ -0,0 +1,6 @@ +class C { + def c(a: Any, b: Any*) = a +} +object Test { + new C().c(b = new { val x = 42 }, a = 0) +} diff --git a/test/files/run/t10009.scala b/test/files/run/t10009.scala new file mode 100644 index 0000000000..2a318752f1 --- /dev/null +++ b/test/files/run/t10009.scala @@ -0,0 +1,28 @@ +import scala.reflect.runtime.currentMirror +import scala.reflect.runtime.universe._ +import scala.tools.reflect.ToolBox + +object Test { + def test(code: String, log: Boolean = false) { + val tb = currentMirror.mkToolBox() + val tree = tb.parse(code) + val typed = tb.typecheck(tree) + if (log) { + println("=" * 80) + println(typed) + } + val untyped = tb.untypecheck(typed) + if (log) println(untyped) + val retyped = tb.typecheck(untyped) + if (log) println(retyped) + } + def main(args: Array[String]): Unit = { + test("{ class a { val x = 42 }; new a }") // failed + test("{ trait a { val x = 42 }; new a {} }") // worked + test("{ abstract class a { val x: Int } }") // worked + test("{ abstract class a { val x: Int }; new a { val x = 42 } }") // failed + test("{ class a { private val x = 42 }; new a }") // failed + test("{ class a { protected val x = 42 }; new a { x } }") // failed + test("{ class a { protected[a] val x = 42 }; new a }") // failed + } +}
\ No newline at end of file |