diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-09-15 15:18:30 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-15 15:18:30 +1000 |
commit | be43eb5fba5da844f664cca10783bb869c7b76e7 (patch) | |
tree | 225b1aecc8dcb6c77248e1c5a308c3151cd995c2 /test | |
parent | 81effdb9a2cd9e94b88f18181b8405a32f883f71 (diff) | |
parent | a5bb6e00f051bf93fe7df4a02583eba478fa5ca1 (diff) | |
download | scala-be43eb5fba5da844f664cca10783bb869c7b76e7.tar.gz scala-be43eb5fba5da844f664cca10783bb869c7b76e7.tar.bz2 scala-be43eb5fba5da844f664cca10783bb869c7b76e7.zip |
Merge pull request #5398 from retronym/ticket/SD-225
SD-225 Use a "lzycompute" method for module initialization
Diffstat (limited to 'test')
4 files changed, 16 insertions, 7 deletions
diff --git a/test/files/run/delambdafy_t6028.check b/test/files/run/delambdafy_t6028.check index eaba70ee1a..6a15b3b003 100644 --- a/test/files/run/delambdafy_t6028.check +++ b/test/files/run/delambdafy_t6028.check @@ -42,10 +42,11 @@ package <empty> { <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer; <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer }; + final private[this] def MethodLocalObject$lzycompute$1(barParam$1: String, MethodLocalObject$module$1: runtime.VolatileObjectRef): Unit = T.this.synchronized[Unit](if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1)); final <stable> private[this] def MethodLocalObject$1(barParam$1: String, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) - T.this.synchronized[Unit](if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) - MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1)); + T.this.MethodLocalObject$lzycompute$1(barParam$1, MethodLocalObject$module$1); MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]() }; final <artifact> private[this] def $anonfun$tryy$1(tryyParam$1: String, tryyLocal$1: runtime.ObjectRef): Unit = try { diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check index d6cc452bbf..80f8698ecf 100644 --- a/test/files/run/t6028.check +++ b/test/files/run/t6028.check @@ -54,10 +54,11 @@ package <empty> { <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer; <synthetic> <stable> <artifact> def $outer(): T = MethodLocalObject$2.this.$outer }; + final private[this] def MethodLocalObject$lzycompute$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): Unit = T.this.synchronized[Unit](if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) + MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1)); final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) - T.this.synchronized[Unit](if (MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]().eq(null)) - MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1)); + T.this.MethodLocalObject$lzycompute$1(barParam$1, MethodLocalObject$module$1); MethodLocalObject$module$1.elem.$asInstanceOf[T#MethodLocalObject$2.type]() }; @SerialVersionUID(value = 0) final <synthetic> class $anonfun$tryy$1 extends scala.runtime.AbstractFunction0$mcV$sp with Serializable { 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 85b44d9fa0..95b47f7d04 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlineWarningTest.scala @@ -198,7 +198,9 @@ class InlineWarningTest extends BytecodeTesting { |Note that class A is defined in a Java source (mixed compilation), no bytecode is available.""".stripMargin ) var c = 0 - compileClasses(sCode, javaCode = List((jCode, "A.java")), allowMessage = i => { c += 1; warns.exists(i.msg.contains)}) + compileClasses(sCode, javaCode = List((jCode, "A.java")), allowMessage = i => { c += 1; + warns.exists(i.msg.contains) + }) assert(c == 2) } } 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 eae5385147..8861577366 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala @@ -107,7 +107,9 @@ class ScalaInlineInfoTest extends BytecodeTesting { ("x5$(LT;)I", MethodInlineInfo(true ,false,false)), ("L$1(Lscala/runtime/VolatileObjectRef;)LT$L$2$;", MethodInlineInfo(true, false,false)), ("nest$1()I", MethodInlineInfo(true, false,false)), - ("$init$(LT;)V", MethodInlineInfo(true,false,false))), + ("$init$(LT;)V", MethodInlineInfo(true,false,false)), + ("L$lzycompute$1(Lscala/runtime/VolatileObjectRef;)V", MethodInlineInfo(true,false,false)) + ), None // warning ) @@ -128,7 +130,9 @@ class ScalaInlineInfoTest extends BytecodeTesting { "x4()I" -> MethodInlineInfo(false,false,false), // "x5()I" -> MethodInlineInfo(true ,false,false), -- there is no x5 in the class as it's implemented fully in the interface "T$$super$toString()Ljava/lang/String;" -> MethodInlineInfo(true ,false,false), - "<init>()V" -> MethodInlineInfo(false,false,false)), + "<init>()V" -> MethodInlineInfo(false,false,false), + "O$lzycompute$1()V" -> MethodInlineInfo(true,false,false) + ), None) assert(infoC == expectC, mapDiff(expectC.methodInfos, infoC.methodInfos) + infoC) @@ -179,6 +183,7 @@ class ScalaInlineInfoTest extends BytecodeTesting { val infoC = inlineInfo(c) val expected = Map( "<init>()V" -> MethodInlineInfo(false,false,false), + "O$lzycompute$1()V" -> MethodInlineInfo(true,false,false), "O()LC$O$;" -> MethodInlineInfo(true,false,false)) assert(infoC.methodInfos == expected, mapDiff(infoC.methodInfos, expected)) assertSameMethods(c, expected.keySet) |