aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Stucki <nicolas.stucki@gmail.com>2016-10-11 10:47:42 +0200
committerNicolas Stucki <nicolas.stucki@gmail.com>2016-10-11 10:52:34 +0200
commit13c5c28671cb8b61fd28661629e88e24f3b92faf (patch)
treec22ec0ea9fa425f3b3d7b852a67ec2631a7a968c
parent618cebbec6fd5727b51974fa372ae984c03f9f99 (diff)
downloaddotty-13c5c28671cb8b61fd28661629e88e24f3b92faf.tar.gz
dotty-13c5c28671cb8b61fd28661629e88e24f3b92faf.tar.bz2
dotty-13c5c28671cb8b61fd28661629e88e24f3b92faf.zip
Fix #1543: Ignore IgnoredProto when normalizing method application.
-rw-r--r--src/dotty/tools/dotc/typer/ProtoTypes.scala7
-rw-r--r--tests/run/i1543.check31
-rw-r--r--tests/run/i1543.scala41
3 files changed, 76 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala
index 0e6697fb7..751ed928b 100644
--- a/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -395,9 +395,10 @@ object ProtoTypes {
if (mt.isDependent) tp
else {
val rt = normalize(mt.resultType, pt)
- if (pt.isInstanceOf[ApplyingProto])
- mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
- else {
+ pt match {
+ case pt: IgnoredProto => mt
+ case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
+ case _ =>
val ft = defn.FunctionOf(mt.paramTypes, rt)
if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
}
diff --git a/tests/run/i1543.check b/tests/run/i1543.check
new file mode 100644
index 000000000..10adcaf83
--- /dev/null
+++ b/tests/run/i1543.check
@@ -0,0 +1,31 @@
+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
diff --git a/tests/run/i1543.scala b/tests/run/i1543.scala
new file mode 100644
index 000000000..268bc717b
--- /dev/null
+++ b/tests/run/i1543.scala
@@ -0,0 +1,41 @@
+
+object Test extends dotty.runtime.LegacyApp {
+ 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)
+}
+
+
+class Bar {
+ 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 = {
+ println(p1)
+ println(p2)
+ println(p3)
+ println(p4)
+ println(p5)
+ println(p6)
+ println(p7)
+ println(p8)
+ println(p9)
+ println(p10)
+ println(p11)
+ println(p12)
+ println(p13)
+ println(p14)
+ println(p15)
+ println(p16)
+ println(p17)
+ println(p18)
+ println(p19)
+ println(p20)
+ println(p21)
+ println(p22)
+ println(p23)
+ println(p24)
+ println(p25)
+ println(p26)
+ println(p27)
+ println(p28)
+ println(p29)
+ println(p30)
+ println(p31)
+ }
+}