From 7fa77afa9322d4d31b132d1c1c8b57c7a3199348 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 27 Sep 2013 09:25:37 -0700 Subject: SI-3971 error message carat mispoints at curried methods. Point at the beginning of the first argument list when reporting an error, as this is most easily associated with the application taking place (which may involve multiple applies in succession.) Thanks to retronym for figuring out why issuing a better error message broke the compiler on non-erroneous compile runs. The changes to "treesInResult" are the consequence. --- test/files/neg/t3971.check | 21 +++++++++++++++++++++ test/files/neg/t3971.scala | 12 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/files/neg/t3971.check create mode 100644 test/files/neg/t3971.scala (limited to 'test/files') diff --git a/test/files/neg/t3971.check b/test/files/neg/t3971.check new file mode 100644 index 0000000000..8685119876 --- /dev/null +++ b/test/files/neg/t3971.check @@ -0,0 +1,21 @@ +t3971.scala:6: error: type mismatch; + found : Int + required: String + f(g("abc")("def")) // g returns Int, needs String + ^ +t3971.scala:7: error: type mismatch; + found : Int(5) + required: String + f(5) + ^ +t3971.scala:8: error: type mismatch; + found : Int + required: String + f(h("abc")) + ^ +t3971.scala:11: error: type mismatch; + found : Boolean + required: String + ({"ab".reverse; "ba".equals})(0): String + ^ +four errors found diff --git a/test/files/neg/t3971.scala b/test/files/neg/t3971.scala new file mode 100644 index 0000000000..35f64fde0c --- /dev/null +++ b/test/files/neg/t3971.scala @@ -0,0 +1,12 @@ +class A { + def f(x: String) = x + def g(x: String)(y: String): Int = x.length + y.length + def h(x: String) = x.length + + f(g("abc")("def")) // g returns Int, needs String + f(5) + f(h("abc")) + + // a perverse piece of code from a perverse coder + ({"ab".reverse; "ba".equals})(0): String +} -- cgit v1.2.3