@@ -45,17 +45,18 @@ class InlineBytecodeTests extends DottyBytecodeTest {
45
45
@ Test def i4947 = {
46
46
val source = """ class Foo {
47
47
| transparent def track[T](f: => T): T = {
48
- | println ("tracking") // line 3
48
+ | foo ("tracking") // line 3
49
49
| f // line 4
50
50
| }
51
51
| def main(args: Array[String]): Unit = { // line 6
52
52
| track { // line 7
53
- | println ("abc") // line 8
53
+ | foo ("abc") // line 8
54
54
| track { // line 9
55
- | println ("inner") // line 10
55
+ | foo ("inner") // line 10
56
56
| }
57
57
| } // line 11
58
58
| }
59
+ | def foo(str: String): Unit = ()
59
60
|}
60
61
""" .stripMargin
61
62
@@ -73,24 +74,24 @@ class InlineBytecodeTests extends DottyBytecodeTest {
73
74
Label (0 ),
74
75
LineNumber (6 , Label (0 )),
75
76
LineNumber (3 , Label (0 )),
76
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
77
+ VarOp ( ALOAD , 0 ),
77
78
Ldc (LDC , " tracking" ),
78
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
79
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
79
80
Label (6 ),
80
81
LineNumber (8 , Label (6 )),
81
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
82
+ VarOp ( ALOAD , 0 ),
82
83
Ldc (LDC , " abc" ),
83
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
84
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
84
85
Label (11 ),
85
86
LineNumber (3 , Label (11 )),
86
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
87
+ VarOp ( ALOAD , 0 ),
87
88
Ldc (LDC , " tracking" ),
88
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
89
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
89
90
Label (16 ),
90
91
LineNumber (10 , Label (16 )),
91
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
92
+ VarOp ( ALOAD , 0 ),
92
93
Ldc (LDC , " inner" ),
93
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
94
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
94
95
Op (RETURN ),
95
96
Label (22 )
96
97
)
@@ -103,20 +104,21 @@ class InlineBytecodeTests extends DottyBytecodeTest {
103
104
@ Test def i4947b = {
104
105
val source = """ class Foo {
105
106
| transparent def track2[T](f: => T): T = {
106
- | println ("tracking2") // line 3
107
+ | foo ("tracking2") // line 3
107
108
| f // line 4
108
109
| }
109
110
| transparent def track[T](f: => T): T = {
110
- | println ("tracking") // line 7
111
+ | foo ("tracking") // line 7
111
112
| track2 { // line 8
112
113
| f // line 9
113
114
| }
114
115
| }
115
116
| def main(args: Array[String]): Unit = { // line 12
116
117
| track { // line 13
117
- | println ("abc") // line 14
118
+ | foo ("abc") // line 14
118
119
| }
119
120
| }
121
+ | def foo(str: String): Unit = ()
120
122
|}
121
123
""" .stripMargin
122
124
@@ -137,19 +139,19 @@ class InlineBytecodeTests extends DottyBytecodeTest {
137
139
Label (0 ),
138
140
LineNumber (12 , Label (0 )),
139
141
LineNumber (7 , Label (0 )),
140
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
142
+ VarOp ( ALOAD , 0 ),
141
143
Ldc (LDC , " tracking" ),
142
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
144
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
143
145
Label (6 ),
144
146
LineNumber (3 , Label (6 )),
145
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
147
+ VarOp ( ALOAD , 0 ),
146
148
Ldc (LDC , " tracking2" ),
147
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
149
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
148
150
Label (11 ),
149
151
LineNumber (14 , Label (11 )),
150
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
152
+ VarOp ( ALOAD , 0 ),
151
153
Ldc (LDC , " abc" ),
152
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
154
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
153
155
Op (RETURN ),
154
156
Label (17 )
155
157
)
@@ -162,20 +164,21 @@ class InlineBytecodeTests extends DottyBytecodeTest {
162
164
@ Test def i4947c = {
163
165
val source = """ class Foo {
164
166
| transparent def track2[T](f: => T): T = {
165
- | println ("tracking2") // line 3
167
+ | foo ("tracking2") // line 3
166
168
| f // line 4
167
169
| }
168
170
| transparent def track[T](f: => T): T = {
169
171
| track2 { // line 7
170
- | println ("fgh") // line 8
172
+ | foo ("fgh") // line 8
171
173
| f // line 9
172
174
| }
173
175
| }
174
176
| def main(args: Array[String]): Unit = { // line 12
175
177
| track { // line 13
176
- | println ("abc") // line 14
178
+ | foo ("abc") // line 14
177
179
| }
178
180
| }
181
+ | def foo(str: String): Unit = ()
179
182
|}
180
183
""" .stripMargin
181
184
@@ -196,19 +199,19 @@ class InlineBytecodeTests extends DottyBytecodeTest {
196
199
Label (0 ),
197
200
LineNumber (12 , Label (0 )),
198
201
LineNumber (3 , Label (0 )),
199
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
202
+ VarOp ( ALOAD , 0 ),
200
203
Ldc (LDC , " tracking2" ),
201
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
204
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
202
205
Label (6 ),
203
206
LineNumber (8 , Label (6 )),
204
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
207
+ VarOp ( ALOAD , 0 ),
205
208
Ldc (LDC , " fgh" ),
206
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
209
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
207
210
Label (11 ),
208
211
LineNumber (14 , Label (11 )),
209
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
212
+ VarOp ( ALOAD , 0 ),
210
213
Ldc (LDC , " abc" ),
211
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
214
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
212
215
Op (RETURN ),
213
216
Label (17 )
214
217
)
@@ -221,7 +224,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
221
224
@ Test def i4947d = {
222
225
val source = """ class Foo {
223
226
| transparent def track2[T](f: => T): T = {
224
- | println ("tracking2") // line 3
227
+ | foo ("tracking2") // line 3
225
228
| f // line 4
226
229
| }
227
230
| transparent def track[T](f: => T): T = {
@@ -233,9 +236,10 @@ class InlineBytecodeTests extends DottyBytecodeTest {
233
236
| }
234
237
| def main(args: Array[String]): Unit = { // line 13
235
238
| track { // line 14
236
- | println ("abc") // line 15
239
+ | foo ("abc") // line 15
237
240
| }
238
241
| }
242
+ | def foo(str: String): Unit = ()
239
243
|}
240
244
""" .stripMargin
241
245
@@ -256,19 +260,19 @@ class InlineBytecodeTests extends DottyBytecodeTest {
256
260
Label (0 ),
257
261
LineNumber (13 , Label (0 )),
258
262
LineNumber (3 , Label (0 )),
259
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
263
+ VarOp ( ALOAD , 0 ),
260
264
Ldc (LDC , " tracking2" ),
261
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
265
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
262
266
Label (6 ),
263
267
LineNumber (3 , Label (6 )),
264
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
268
+ VarOp ( ALOAD , 0 ),
265
269
Ldc (LDC , " tracking2" ),
266
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
270
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
267
271
Label (11 ),
268
272
LineNumber (15 , Label (11 )),
269
- Field ( GETSTATIC , " scala/Predef$ " , " MODULE$ " , " Lscala/Predef$; " ),
273
+ VarOp ( ALOAD , 0 ),
270
274
Ldc (LDC , " abc" ),
271
- Invoke (INVOKEVIRTUAL , " scala/Predef$ " , " println " , " (Ljava/lang/Object ;)V" , false ),
275
+ Invoke (INVOKEVIRTUAL , " Foo " , " foo " , " (Ljava/lang/String ;)V" , false ),
272
276
Op (RETURN ),
273
277
Label (17 )
274
278
)
0 commit comments