diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-13 12:21:23 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-04-20 08:53:52 +0200 |
commit | b61c35c38931be3b690bce92d5db9647802b1b34 (patch) | |
tree | ad3250fe1c29f54e5aba317e98409308c419376f /test/junit/scala/tools/nsc/backend/jvm/opt | |
parent | 3fca034c51dd159ff077fdde7e3146b1e41cc925 (diff) | |
download | scala-b61c35c38931be3b690bce92d5db9647802b1b34.tar.gz scala-b61c35c38931be3b690bce92d5db9647802b1b34.tar.bz2 scala-b61c35c38931be3b690bce92d5db9647802b1b34.zip |
Ensure that lzycompute methods are entered into the scope
For some reason this was not the case, leading to spurious inliner
warnings (no inline info found for method O$lzycompute).
Diffstat (limited to 'test/junit/scala/tools/nsc/backend/jvm/opt')
-rw-r--r-- | test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala index 46b3ad3f8e..e2d03d8c62 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala @@ -24,8 +24,7 @@ object ScalaInlineInfoTest extends ClearAfterClass.Clearable { @RunWith(classOf[JUnit4]) class ScalaInlineInfoTest extends ClearAfterClass { ClearAfterClass.stateToClear = ScalaInlineInfoTest - - val compiler = newCompiler() + val compiler = ScalaInlineInfoTest.compiler def inlineInfo(c: ClassNode): InlineInfo = c.attrs.asScala.collect({ case a: InlineInfoAttribute => a.inlineInfo }).head @@ -113,6 +112,7 @@ class ScalaInlineInfoTest extends ClearAfterClass { val infoC = inlineInfo(c) val expectC = InlineInfo(false, None, Map( "O()LT$O$;" -> MethodInlineInfo(true ,false,false), + "O$lzycompute()LT$O$;" -> MethodInlineInfo(true, false,false), "f6()I" -> MethodInlineInfo(false,false,false), "x1()I" -> MethodInlineInfo(false,false,false), "T$_setter_$x1_$eq(I)V" -> MethodInlineInfo(false,false,false), @@ -167,4 +167,16 @@ class ScalaInlineInfoTest extends ClearAfterClass { ("U",None))) } + + @Test + def lzyComputeInlineInfo(): Unit = { + val code = "class C { object O }" + val List(c, om) = compileClasses(compiler)(code) + val infoC = inlineInfo(c) + val expected = Map( + "<init>()V" -> MethodInlineInfo(false,false,false), + "O$lzycompute()LC$O$;" -> MethodInlineInfo(true,false,false), + "O()LC$O$;" -> MethodInlineInfo(true,false,false)) + assert(infoC.methodInfos == expected, mapDiff(infoC.methodInfos, expected)) + } } |