diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-04-14 14:00:33 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-06-01 11:19:54 +1000 |
commit | e077c24525bf8f9bd8b73684e630eb7fc6bcb5f6 (patch) | |
tree | ad9468ed7023c9cbf129585aea73730413d3e2af /test/junit | |
parent | f01d061caaae26b3fdff0e4db800292e9b3252c2 (diff) | |
download | scala-e077c24525bf8f9bd8b73684e630eb7fc6bcb5f6.tar.gz scala-e077c24525bf8f9bd8b73684e630eb7fc6bcb5f6.tar.bz2 scala-e077c24525bf8f9bd8b73684e630eb7fc6bcb5f6.zip |
SI-9390 Emit local defs that don't capture this as static
This avoids unnecessary memory retention, and allows lambdas
that call the local methods to be serializable, regardless of
whether or not the enclosing class is serializable.
The second point is especially pressing, given that the enclosing
class for local methods defined in a used to be the (serializable)
anonymous function class, but as of Scala 2.12 will be the enclosing
class of the lambda.
This change is similar in spirit to SI-9408 / 93bee55e.
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala | 4 | ||||
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala index 6161dc7b73..024cf0c416 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala @@ -113,7 +113,7 @@ class InlineWarningTest extends BytecodeTesting { val warn = """M::f()I is annotated @inline but could not be inlined: - |The callee M::f()I contains the instruction INVOKESPECIAL M.nested$1 ()I + |The callee M::f()I contains the instruction INVOKESTATIC M.nested$1 ()I |that would cause an IllegalAccessError when inlined into class N""".stripMargin var c = 0 @@ -140,7 +140,7 @@ class InlineWarningTest extends BytecodeTesting { val warn = """M::f(Lscala/Function1;)I could not be inlined: - |The callee M::f(Lscala/Function1;)I contains the instruction INVOKESPECIAL M.nested$1 ()I + |The callee M::f(Lscala/Function1;)I contains the instruction INVOKESTATIC M.nested$1 ()I |that would cause an IllegalAccessError when inlined into class N""".stripMargin var c = 0 diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala index 7234659a1d..02cd632af1 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala @@ -1141,7 +1141,7 @@ class InlinerTest extends BytecodeTesting { val warn = """C::h()I is annotated @inline but could not be inlined: - |The callee C::h()I contains the instruction INVOKESPECIAL C.f$1 ()I + |The callee C::h()I contains the instruction INVOKESTATIC C.f$1 ()I |that would cause an IllegalAccessError when inlined into class D.""".stripMargin val List(c, d) = compile(code, allowMessage = _.msg contains warn) |