Skip to content

Commit 067ec76

Browse files
authored
Backport "Only lift inner expressions when lifting repeated Typed arguments" to LTS (#19234)
Backports #18424 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 234d0f2 + b8d2fd5 commit 067ec76

File tree

7 files changed

+781
-4
lines changed

7 files changed

+781
-4
lines changed

compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ abstract class Lifter {
7676
tree
7777
}
7878

79-
/** Lift a function argument, stripping any NamedArg wrapper */
79+
/** Lift a function argument, stripping any NamedArg wrapper and repeated Typed trees */
8080
private def liftArg(defs: mutable.ListBuffer[Tree], arg: Tree, prefix: TermName = EmptyTermName)(using Context): Tree =
8181
arg match {
8282
case arg @ NamedArg(name, arg1) => cpy.NamedArg(arg)(name, lift(defs, arg1, prefix))
83+
case arg @ Typed(arg1, tpt) if tpt.typeOpt.isRepeatedParam => cpy.Typed(arg)(lift(defs, arg1, prefix), tpt)
8384
case arg => lift(defs, arg, prefix)
8485
}
8586

tests/run/i16940.scala renamed to tests/coverage/run/i16940/i16940.scala

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// scalac: -coverage-out:coverage
2-
// scalajs: --skip
3-
41
import concurrent.ExecutionContext.Implicits.global
52
import scala.concurrent.*
63
import scala.concurrent.duration.*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
# Coverage data, format version: 3.0
2+
# Statement data:
3+
# - id
4+
# - source path
5+
# - package name
6+
# - class name
7+
# - class type (Class, Object or Trait)
8+
# - full class name
9+
# - method name
10+
# - start offset
11+
# - end offset
12+
# - line number
13+
# - symbol name
14+
# - tree name
15+
# - is branch
16+
# - invocations count
17+
# - is ignored
18+
# - description (can be multi-line)
19+
# ' ' sign
20+
# ------------------------------------------
21+
0
22+
i16940/i16940.scala
23+
<empty>
24+
Test$
25+
Object
26+
<empty>.Test$
27+
<init>
28+
353
29+
552
30+
18
31+
result
32+
Apply
33+
false
34+
0
35+
false
36+
Await.result(\n Future.sequence(Seq(brokenSynchronizedBlock(false), brokenSynchronizedBlock(true)))\n .map { result =>\n println(test)\n assert(test == 2)\n },\n 3.seconds\n )
37+
38+
1
39+
i16940/i16940.scala
40+
<empty>
41+
Test$
42+
Object
43+
<empty>.Test$
44+
<init>
45+
371
46+
533
47+
19
48+
map
49+
Apply
50+
false
51+
0
52+
false
53+
Future.sequence(Seq(brokenSynchronizedBlock(false), brokenSynchronizedBlock(true)))\n .map { result =>\n println(test)\n assert(test == 2)\n }
54+
55+
2
56+
i16940/i16940.scala
57+
<empty>
58+
Test$
59+
Object
60+
<empty>.Test$
61+
<init>
62+
371
63+
454
64+
19
65+
sequence
66+
Apply
67+
false
68+
0
69+
false
70+
Future.sequence(Seq(brokenSynchronizedBlock(false), brokenSynchronizedBlock(true)))
71+
72+
3
73+
i16940/i16940.scala
74+
<empty>
75+
Test$
76+
Object
77+
<empty>.Test$
78+
<init>
79+
387
80+
453
81+
19
82+
apply
83+
Apply
84+
false
85+
0
86+
false
87+
Seq(brokenSynchronizedBlock(false), brokenSynchronizedBlock(true))
88+
89+
4
90+
i16940/i16940.scala
91+
<empty>
92+
Test$
93+
Object
94+
<empty>.Test$
95+
<init>
96+
387
97+
390
98+
19
99+
Seq
100+
Ident
101+
false
102+
0
103+
false
104+
Seq
105+
106+
5
107+
i16940/i16940.scala
108+
<empty>
109+
Test$
110+
Object
111+
<empty>.Test$
112+
<init>
113+
391
114+
421
115+
19
116+
brokenSynchronizedBlock
117+
Apply
118+
false
119+
0
120+
false
121+
brokenSynchronizedBlock(false)
122+
123+
6
124+
i16940/i16940.scala
125+
<empty>
126+
Test$
127+
Object
128+
<empty>.Test$
129+
<init>
130+
423
131+
452
132+
19
133+
brokenSynchronizedBlock
134+
Apply
135+
false
136+
0
137+
false
138+
brokenSynchronizedBlock(true)
139+
140+
7
141+
i16940/i16940.scala
142+
<empty>
143+
Test$
144+
Object
145+
<empty>.Test$
146+
$anonfun
147+
486
148+
499
149+
21
150+
println
151+
Apply
152+
false
153+
0
154+
false
155+
println(test)
156+
157+
8
158+
i16940/i16940.scala
159+
<empty>
160+
Test$
161+
Object
162+
<empty>.Test$
163+
$anonfun
164+
508
165+
525
166+
22
167+
assertFailed
168+
Apply
169+
false
170+
0
171+
false
172+
assert(test == 2)
173+
174+
9
175+
i16940/i16940.scala
176+
<empty>
177+
Test$
178+
Object
179+
<empty>.Test$
180+
$anonfun
181+
508
182+
525
183+
22
184+
assertFailed
185+
Apply
186+
true
187+
0
188+
false
189+
assert(test == 2)
190+
191+
10
192+
i16940/i16940.scala
193+
<empty>
194+
Test$
195+
Object
196+
<empty>.Test$
197+
$anonfun
198+
508
199+
525
200+
22
201+
<none>
202+
Literal
203+
true
204+
0
205+
false
206+
assert(test == 2)
207+
208+
11
209+
i16940/i16940.scala
210+
<empty>
211+
Test$
212+
Object
213+
<empty>.Test$
214+
<init>
215+
539
216+
548
217+
24
218+
seconds
219+
Select
220+
false
221+
0
222+
false
223+
3.seconds
224+
225+
12
226+
i16940/i16940.scala
227+
<empty>
228+
i16940$package$
229+
Object
230+
<empty>.i16940$package$
231+
brokenSynchronizedBlock
232+
189
233+
323
234+
6
235+
apply
236+
Apply
237+
false
238+
0
239+
false
240+
Future {\n if (option) {\n Thread.sleep(500)\n }\n synchronized {\n val tmp = test\n Thread.sleep(1000)\n test = tmp + 1\n }\n}
241+
242+
13
243+
i16940/i16940.scala
244+
<empty>
245+
i16940$package$
246+
Object
247+
<empty>.i16940$package$
248+
brokenSynchronizedBlock
249+
218
250+
235
251+
8
252+
sleep
253+
Apply
254+
false
255+
0
256+
false
257+
Thread.sleep(500)
258+
259+
14
260+
i16940/i16940.scala
261+
<empty>
262+
i16940$package$
263+
Object
264+
<empty>.i16940$package$
265+
brokenSynchronizedBlock
266+
212
267+
239
268+
7
269+
<none>
270+
Block
271+
true
272+
0
273+
false
274+
{\n Thread.sleep(500)\n }
275+
276+
15
277+
i16940/i16940.scala
278+
<empty>
279+
i16940$package$
280+
Object
281+
<empty>.i16940$package$
282+
brokenSynchronizedBlock
283+
239
284+
239
285+
9
286+
<none>
287+
Literal
288+
true
289+
0
290+
false
291+
292+
293+
16
294+
i16940/i16940.scala
295+
<empty>
296+
i16940$package$
297+
Object
298+
<empty>.i16940$package$
299+
brokenSynchronizedBlock
300+
242
301+
321
302+
10
303+
synchronized
304+
Apply
305+
false
306+
0
307+
false
308+
synchronized {\n val tmp = test\n Thread.sleep(1000)\n test = tmp + 1\n }
309+
310+
17
311+
i16940/i16940.scala
312+
<empty>
313+
i16940$package$
314+
Object
315+
<empty>.i16940$package$
316+
brokenSynchronizedBlock
317+
280
318+
298
319+
12
320+
sleep
321+
Apply
322+
false
323+
0
324+
false
325+
Thread.sleep(1000)
326+
327+
18
328+
i16940/i16940.scala
329+
<empty>
330+
i16940$package$
331+
Object
332+
<empty>.i16940$package$
333+
brokenSynchronizedBlock
334+
128
335+
155
336+
6
337+
brokenSynchronizedBlock
338+
DefDef
339+
false
340+
0
341+
false
342+
def brokenSynchronizedBlock
343+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def aList =
2+
List(Array[String]()*)
3+
4+
def arr =
5+
Array("abc", "def")
6+
7+
def anotherList =
8+
List(arr*)
9+
10+
object Test extends App {
11+
println(aList)
12+
println(anotherList)
13+
}

0 commit comments

Comments
 (0)