diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-07-07 09:24:50 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-14 17:46:45 +0200 |
commit | a3bf34563d718f19ad02ff9ac5a2a1cec865aa24 (patch) | |
tree | 0725474dd1873e173a60508c420d031c7347d8c2 /test | |
parent | 32dc7e80698c83947bf4b74f6eadd385a06f5b09 (diff) | |
download | scala-a3bf34563d718f19ad02ff9ac5a2a1cec865aa24.tar.gz scala-a3bf34563d718f19ad02ff9ac5a2a1cec865aa24.tar.bz2 scala-a3bf34563d718f19ad02ff9ac5a2a1cec865aa24.zip |
SI-6028 Avoid needless symbol renaming in lambdalift.
Preserve names of all referenced free vars. Only the proxy symbols
have the fresh names.
The resulting natural beauty is evident in the diff of t6028.check.
This subsumes the treatment in 0e170e4b that ensured named parameter
calls cannot see mangled names; pos/t6028 confirms as much.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/t6028/t6028_1.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t6028/t6028_2.scala | 4 | ||||
-rw-r--r-- | test/files/run/t6028.check | 18 | ||||
-rw-r--r-- | test/files/run/t6028.scala | 1 |
4 files changed, 16 insertions, 10 deletions
diff --git a/test/files/pos/t6028/t6028_1.scala b/test/files/pos/t6028/t6028_1.scala new file mode 100644 index 0000000000..6edb76069e --- /dev/null +++ b/test/files/pos/t6028/t6028_1.scala @@ -0,0 +1,3 @@ +class C { + def foo(a: Int): Unit = () => a +} diff --git a/test/files/pos/t6028/t6028_2.scala b/test/files/pos/t6028/t6028_2.scala new file mode 100644 index 0000000000..f44048c0ab --- /dev/null +++ b/test/files/pos/t6028/t6028_2.scala @@ -0,0 +1,4 @@ +object Test { + // ensure that parameter names are untouched by lambdalift + new C().foo(a = 0) +} diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check index 6c9930b503..dca61115ad 100644 --- a/test/files/run/t6028.check +++ b/test/files/run/t6028.check @@ -8,20 +8,20 @@ package <empty> { }; private[this] val field: Int = 0; <stable> <accessor> def field(): Int = T.this.field; - def foo(methodParam$1: Int): Function0 = { - val methodLocal$1: Int = 0; + def foo(methodParam: Int): Function0 = { + val methodLocal: Int = 0; { - (new anonymous class $anonfun$foo$1(T.this, methodParam$1, methodLocal$1): Function0) + (new anonymous class $anonfun$foo$1(T.this, methodParam, methodLocal): Function0) } }; - def bar(barParam$1: Int): Object = { - @volatile var MethodLocalObject$module$1: scala.runtime.VolatileObjectRef = new scala.runtime.VolatileObjectRef(<empty>); - T.this.MethodLocalObject$1(barParam$1, MethodLocalObject$module$1) + def bar(barParam: Int): Object = { + @volatile var MethodLocalObject$module: scala.runtime.VolatileObjectRef = new scala.runtime.VolatileObjectRef(<empty>); + T.this.MethodLocalObject$1(barParam, MethodLocalObject$module) }; - def tryy(tryyParam$1: Int): Function0 = { - var tryyLocal$1: scala.runtime.IntRef = new scala.runtime.IntRef(0); + def tryy(tryyParam: Int): Function0 = { + var tryyLocal: scala.runtime.IntRef = new scala.runtime.IntRef(0); { - (new anonymous class $anonfun$tryy$1(T.this, tryyParam$1, tryyLocal$1): Function0) + (new anonymous class $anonfun$tryy$1(T.this, tryyParam, tryyLocal): Function0) } }; @SerialVersionUID(0) final <synthetic> class $anonfun$foo$1 extends scala.runtime.AbstractFunction0$mcI$sp with Serializable { diff --git a/test/files/run/t6028.scala b/test/files/run/t6028.scala index 7611aee0fc..cab17535fc 100644 --- a/test/files/run/t6028.scala +++ b/test/files/run/t6028.scala @@ -14,7 +14,6 @@ object Test extends DirectTest { |""".stripMargin.trim override def show(): Unit = { - // redirect err to out, for logging Console.withErr(System.out) { compile() } |