From 9c821cb83ce6b6f566620432ef3b5d70f54c67d2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 5 Nov 2016 15:01:28 +0100 Subject: Fix #1640: Avoid applications with untyped function parts Avoid applications with untyped function parts even if program is erroneous. Taking the symbol fails for these applications, which can cause crashes. --- tests/neg/i1640.scala | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tests/neg/i1640.scala (limited to 'tests') diff --git a/tests/neg/i1640.scala b/tests/neg/i1640.scala new file mode 100644 index 000000000..78351a1d6 --- /dev/null +++ b/tests/neg/i1640.scala @@ -0,0 +1,4 @@ +object Test extends App { + List(1, 2, 3) map (_ match { case x => x + 1 }) + List((1, 2)) x (_ match { case (x, z) => x + z }) // error +} -- cgit v1.2.3 From ed3f586c8cd8bfcc31f1e0462a5294182b043103 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 5 Nov 2016 15:06:41 +0100 Subject: Test case for #1641 #1641 compiles under latest master. This test case is there to ensure it stays that way. --- tests/neg/i1641.scala | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/neg/i1641.scala (limited to 'tests') diff --git a/tests/neg/i1641.scala b/tests/neg/i1641.scala new file mode 100644 index 000000000..db1daf791 --- /dev/null +++ b/tests/neg/i1641.scala @@ -0,0 +1,8 @@ +package bar { object bippy extends (Double => String) { def apply(x: Double): String = "Double" } } +package object println { def bippy(x: Int, y: Int, z: Int) = "(Int, Int, Int)" } +object Test { + def main(args: Array[String]): Unit = { + println(bar.bippy(5.5)) + println(bar.bippy(1, 2, 3)) // error + } +} -- cgit v1.2.3