You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/test/dotty/tools/backend/jvm/ArrayApplyOptTest.scala
+40-4
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
packagedotty.tools.backend.jvm
1
+
packagedotty.tools
2
+
packagebackend.jvm
2
3
3
4
importorg.junit.Test
4
5
importorg.junit.Assert._
@@ -161,15 +162,50 @@ class ArrayApplyOptTest extends DottyBytecodeTest {
161
162
}
162
163
163
164
@TestdeftestListApplyAvoidsIntermediateArray= {
164
-
valsource=
165
+
checkApplyAvoidsIntermediateArray("List"):
165
166
"""
166
167
|class Foo {
167
168
| def meth1: List[String] = List("1", "2", "3")
168
169
| def meth2: List[String] =
169
-
| new scala.collection.immutable.::("1", new scala.collection.immutable.::("2", new scala.collection.immutable.::("3", scala.collection.immutable.Nil))).asInstanceOf[List[String]]
170
+
| new scala.collection.immutable.::("1", new scala.collection.immutable.::("2", new scala.collection.immutable.::("3", scala.collection.immutable.Nil))).asInstanceOf[List[String]]
171
+
|}
172
+
""".stripMargin
173
+
}
174
+
175
+
@TestdeftestSeqApplyAvoidsIntermediateArray= {
176
+
checkApplyAvoidsIntermediateArray("Seq"):
177
+
"""
178
+
|class Foo {
179
+
| def meth1: Seq[String] = Seq("1", "2", "3")
180
+
| def meth2: Seq[String] =
181
+
| new scala.collection.immutable.::("1", new scala.collection.immutable.::("2", new scala.collection.immutable.::("3", scala.collection.immutable.Nil))).asInstanceOf[List[String]]
| new scala.collection.immutable.::("1", new scala.collection.immutable.::("2", new scala.collection.immutable.::("3", scala.collection.immutable.Nil))).asInstanceOf[List[String]]
| new scala.collection.immutable.::("1", new scala.collection.immutable.::("2", new scala.collection.immutable.::("3", scala.collection.immutable.Nil))).asInstanceOf[List[String]]
0 commit comments