File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -82,4 +82,28 @@ class TestBCode extends DottyBytecodeTest {
82
82
assert(verifySwitch(methodNode, shouldFail = true ))
83
83
}
84
84
}
85
+
86
+ /** Make sure that creating multidim arrays reduces to "multinewarray"
87
+ * instruction
88
+ */
89
+ @ Test def multidimArrays = {
90
+ val source = """
91
+ |object Arr {
92
+ | def arr = Array.ofDim[Int](2, 1)
93
+ |}""" .stripMargin
94
+ checkBCode(source) { dir =>
95
+ val moduleIn = dir.lookupName(" Arr$.class" , directory = false )
96
+ val moduleNode = loadClassNode(moduleIn.input)
97
+ val method = getMethod(moduleNode, " arr" )
98
+
99
+ val hadCorrectInstr =
100
+ instructionsFromMethod(method)
101
+ .collect { case x @ NewArray (op, _, dims) if op == 197 && dims == 2 => x }
102
+ .length > 0
103
+
104
+ assert(hadCorrectInstr,
105
+ " Did not contain \" multianewarray\" instruction in:\n " +
106
+ instructionsFromMethod(method).mkString(" \n " ))
107
+ }
108
+ }
85
109
}
You can’t perform that action at this time.
0 commit comments