Skip to content

Commit 13c5c28

Browse files
committed
Fix #1543: Ignore IgnoredProto when normalizing method application.
1 parent 618cebb commit 13c5c28

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

src/dotty/tools/dotc/typer/ProtoTypes.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,10 @@ object ProtoTypes {
395395
if (mt.isDependent) tp
396396
else {
397397
val rt = normalize(mt.resultType, pt)
398-
if (pt.isInstanceOf[ApplyingProto])
399-
mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
400-
else {
398+
pt match {
399+
case pt: IgnoredProto => mt
400+
case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
401+
case _ =>
401402
val ft = defn.FunctionOf(mt.paramTypes, rt)
402403
if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
403404
}

tests/run/i1543.check

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
1
2+
2
3+
3
4+
4
5+
5
6+
6
7+
7
8+
8
9+
9
10+
10
11+
11
12+
12
13+
13
14+
14
15+
15
16+
16
17+
17
18+
18
19+
19
20+
20
21+
21
22+
22
23+
23
24+
24
25+
25
26+
26
27+
27
28+
28
29+
29
30+
30
31+
31

tests/run/i1543.scala

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
object Test extends dotty.runtime.LegacyApp {
3+
new Bar().foo(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31)
4+
}
5+
6+
7+
class Bar {
8+
def foo(p1: Int, p2: Int, p3: Int, p4: Int, p5: Int, p6: Int, p7: Int, p8: Int, p9: Int, p10: Int, p11: Int, p12: Int, p13: Int, p14: Int, p15: Int, p16: Int, p17: Int, p18: Int, p19: Int, p20: Int, p21: Int, p22: Int, p23: Int, p24: Int, p25: Int, p26: Int, p27: Int, p28: Int, p29: Int, p30: Int, p31: Int): Unit = {
9+
println(p1)
10+
println(p2)
11+
println(p3)
12+
println(p4)
13+
println(p5)
14+
println(p6)
15+
println(p7)
16+
println(p8)
17+
println(p9)
18+
println(p10)
19+
println(p11)
20+
println(p12)
21+
println(p13)
22+
println(p14)
23+
println(p15)
24+
println(p16)
25+
println(p17)
26+
println(p18)
27+
println(p19)
28+
println(p20)
29+
println(p21)
30+
println(p22)
31+
println(p23)
32+
println(p24)
33+
println(p25)
34+
println(p26)
35+
println(p27)
36+
println(p28)
37+
println(p29)
38+
println(p30)
39+
println(p31)
40+
}
41+
}

0 commit comments

Comments
 (0)