summaryrefslogtreecommitdiff
path: root/test/files/run/delambdafy_t6028.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-06-02 13:20:58 +0200
committerJason Zaugg <jzaugg@gmail.com>2015-04-10 12:04:34 +1000
commitea61b3f66007b1a0029a5f22a7de334924390f7c (patch)
tree5a204a737f83d56e05b94c10bdb15d32b661060a /test/files/run/delambdafy_t6028.scala
parentd14e065eb792a1eb77289f4a1320071c57c5d09b (diff)
downloadscala-ea61b3f66007b1a0029a5f22a7de334924390f7c.tar.gz
scala-ea61b3f66007b1a0029a5f22a7de334924390f7c.tar.bz2
scala-ea61b3f66007b1a0029a5f22a7de334924390f7c.zip
Disable -Ydelambdafy:method for specialized FunctionN
The Delambdafy phase generates its `FunctionN` subclasses after the specialization phase. As such, `((x: Int) => x).apply(42)` incurs boxing. This commit falls back to the `-Ydelambdafy:inline` in this case. This is done by running the specialization type map over the type of the function, and seeing if anything changes. To make this work robustly, we first need to ensure that the specialization info transformer has processed all the function types. This is not a fundamental limitation; we could in principle generate the specialized code. A followup change will use `-Ydelambdafy:method` as the basis for invokedymnamic lambdas. As part of that stream of work, we will synthesize specialization-aware lambdas, and remove the fallback to `-Ydelambdafy:inline`. I have updated some tests that intend to test the delambdafy transform to avoid use of specialized function types.
Diffstat (limited to 'test/files/run/delambdafy_t6028.scala')
-rw-r--r--test/files/run/delambdafy_t6028.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/files/run/delambdafy_t6028.scala b/test/files/run/delambdafy_t6028.scala
index 0b7ef48c3d..ca39195310 100644
--- a/test/files/run/delambdafy_t6028.scala
+++ b/test/files/run/delambdafy_t6028.scala
@@ -5,11 +5,11 @@ object Test extends DirectTest {
override def extraSettings: String = "-usejavacp -Ydelambdafy:method -Xprint:lambdalift -d " + testOutput.path
- override def code = """class T(classParam: Int) {
- | val field: Int = 0
- | def foo(methodParam: Int) = {val methodLocal = 0 ; () => classParam + field + methodParam + methodLocal }
- | def bar(barParam: Int) = { trait MethodLocalTrait { print(barParam) }; object MethodLocalObject extends MethodLocalTrait; MethodLocalObject }
- | def tryy(tryyParam: Int) = { var tryyLocal = 0; () => try { tryyLocal = tryyParam } finally () }
+ override def code = """class T(classParam: String) {
+ | val field: String = ""
+ | def foo(methodParam: String) = {val methodLocal = "" ; () => classParam + field + methodParam + methodLocal }
+ | def bar(barParam: String) = { trait MethodLocalTrait { print(barParam) }; object MethodLocalObject extends MethodLocalTrait; MethodLocalObject }
+ | def tryy(tryyParam: String) = { var tryyLocal = ""; () => try { tryyLocal = tryyParam } finally () }
|}
|""".stripMargin.trim