diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t3971.check | 21 | ||||
-rw-r--r-- | test/files/neg/t3971.scala | 12 |
2 files changed, 33 insertions, 0 deletions
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 +} |