aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/i903.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-02 11:45:28 +0100
committerMartin Odersky <odersky@gmail.com>2015-11-02 11:45:28 +0100
commit9da99f11035d94afba05f4bb768b3a9766b26faf (patch)
treed422f38fd3232f8331a2c9d3684cb76248c9dd86 /tests/pos/i903.scala
parent08e880231ff5facd55a80bed0391b22fe85a9f44 (diff)
downloaddotty-9da99f11035d94afba05f4bb768b3a9766b26faf.tar.gz
dotty-9da99f11035d94afba05f4bb768b3a9766b26faf.tar.bz2
dotty-9da99f11035d94afba05f4bb768b3a9766b26faf.zip
Parentheses around a wildcard should not produce a lambda
`(_)` and `(_: T)` should not be converted to functions x => x (x: T) => x
Diffstat (limited to 'tests/pos/i903.scala')
-rw-r--r--tests/pos/i903.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/pos/i903.scala b/tests/pos/i903.scala
new file mode 100644
index 000000000..c84cb1636
--- /dev/null
+++ b/tests/pos/i903.scala
@@ -0,0 +1,24 @@
+object Test {
+ def contains(s: String, i: Int) = true
+ def test1 = {
+ val f = contains("", (_: Int))
+ val ff = contains("", ((_: Int)))
+ f.apply(0)
+ // sandbox/eta.scala:4: error: type mismatch:
+ // found : Int => Int
+ // required: Int
+ // val f = contains("", (_: Int))
+ // ^
+ // sandbox/eta.scala:5: error: apply is not a member of Boolean(f)
+ // f.apply(0)
+ // ^
+ }
+
+ def test2 = {
+ val f = "".contains("", (_: Int)) // dotc:
+ f.apply(0)
+ // sandbox/eta.scala:18: error: apply is not a member of Boolean(f)
+ // f.apply(0)
+ // ^
+ }
+}