diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-21 21:03:11 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:54:18 -0700 |
commit | b0b0abab89f0c40ba3c45b4a1f7bada31040d55a (patch) | |
tree | c98ae4100c042010e5178ec4d1ec15abf5a73b41 /test/junit | |
parent | 49d946d9039a6240765abd26375883875e5ff7e8 (diff) | |
download | scala-b0b0abab89f0c40ba3c45b4a1f7bada31040d55a.tar.gz scala-b0b0abab89f0c40ba3c45b4a1f7bada31040d55a.tar.bz2 scala-b0b0abab89f0c40ba3c45b4a1f7bada31040d55a.zip |
Jason's review feedback (ThisReferringMethodTraverser)
- Re-simplify logging;
- Remove unused method valueTypeToObject;
- Limit ThisReferringMethodTraverser to material parts
of the AST
Limit ThisReferringMethodTraverser's analysis to only look at
template-owned anonfun method bodies, to make sure it's fairly
low overhead.
AFAICT, part of the complexity of this analysis stems from the
desire to make all the lambda impl methods static in
`() => () => 42`: https://gist.github.com/062181846c13e65490cc.
It would possible to accumulate the knowledge we need during the
main transform, rather than in an additional pass. We'd need to
transform template bodies in such a way that we we process
definitions of anonfun methods before usages, which would
currently amount to transforming the stats in reverse.
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/IndySammyTest.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/IndySammyTest.scala b/test/junit/scala/tools/nsc/backend/jvm/IndySammyTest.scala index 6f213e6625..f7218c576c 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/IndySammyTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/IndySammyTest.scala @@ -127,4 +127,10 @@ class IndySammyTest extends ClearAfterClass { List(Op(ICONST_1), Invoke(INVOKESTATIC, "scala/runtime/BoxesRunTime", "boxToInteger", "(I)Ljava/lang/Integer;", false)), Op(IRETURN))() + // Tests ThisReferringMethodsTraverser + @Test + def testStaticIfNoThisReference: Unit = { + val methodNodes = compileMethods(compiler)("def foo = () => () => () => 42") + methodNodes.forall(m => !m.name.contains("anonfun") || (m.access & ACC_STATIC) == ACC_STATIC) + } } |