summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-11-18 07:27:37 +0100
committerLukas Rytz <lukas.rytz@typesafe.com>2015-11-18 07:27:37 +0100
commitfe336167e7a9f68c7ea6beb80e2cbb69cea95ff8 (patch)
tree876f8ebf0990af27b7a7c83344553cb2434075a2 /test/files/pos
parent15ef8399b817edfd941d93b206915ca6093c7b45 (diff)
parent9da23ec80f2046f2aac8de3e690376cf2af642d4 (diff)
downloadscala-fe336167e7a9f68c7ea6beb80e2cbb69cea95ff8.tar.gz
scala-fe336167e7a9f68c7ea6beb80e2cbb69cea95ff8.tar.bz2
scala-fe336167e7a9f68c7ea6beb80e2cbb69cea95ff8.zip
Merge pull request #4822 from retronym/ticket/9178
SI-9178 Don't eta expand to an Function0-like SAM expected type
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/t9178.flags1
-rw-r--r--test/files/pos/t9178.scala13
-rw-r--r--test/files/pos/t9178b.flags1
-rw-r--r--test/files/pos/t9178b.scala7
4 files changed, 22 insertions, 0 deletions
diff --git a/test/files/pos/t9178.flags b/test/files/pos/t9178.flags
new file mode 100644
index 0000000000..7de3c0f3ee
--- /dev/null
+++ b/test/files/pos/t9178.flags
@@ -0,0 +1 @@
+-Xfatal-warnings -deprecation
diff --git a/test/files/pos/t9178.scala b/test/files/pos/t9178.scala
new file mode 100644
index 0000000000..f2cf20a778
--- /dev/null
+++ b/test/files/pos/t9178.scala
@@ -0,0 +1,13 @@
+// eta expansion to Function0 is problematic (as shown here).
+// Perhaps we should we deprecate it? See discussion in the comments of
+// on SI-9178.
+//
+// This test encodes the status quo: no deprecation.
+object Test {
+ def foo(): () => String = () => ""
+ val f: () => Any = foo
+
+ def main(args: Array[String]): Unit = {
+ println(f()) // <function0>
+ }
+}
diff --git a/test/files/pos/t9178b.flags b/test/files/pos/t9178b.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/pos/t9178b.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/pos/t9178b.scala b/test/files/pos/t9178b.scala
new file mode 100644
index 0000000000..cbeaed4f17
--- /dev/null
+++ b/test/files/pos/t9178b.scala
@@ -0,0 +1,7 @@
+abstract class Test{
+ val writeInput: java.io.OutputStream => Unit
+ def getOutputStream(): java.io.OutputStream
+
+ writeInput(getOutputStream)
+}
+