diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-11-18 07:27:37 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-11-18 07:27:37 +0100 |
commit | fe336167e7a9f68c7ea6beb80e2cbb69cea95ff8 (patch) | |
tree | 876f8ebf0990af27b7a7c83344553cb2434075a2 /test/files/run | |
parent | 15ef8399b817edfd941d93b206915ca6093c7b45 (diff) | |
parent | 9da23ec80f2046f2aac8de3e690376cf2af642d4 (diff) | |
download | scala-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/run')
-rw-r--r-- | test/files/run/t9178a.flags | 1 | ||||
-rw-r--r-- | test/files/run/t9178a.scala | 15 | ||||
-rw-r--r-- | test/files/run/t9489.flags | 1 | ||||
-rw-r--r-- | test/files/run/t9489/A.java | 3 | ||||
-rw-r--r-- | test/files/run/t9489/B.java | 3 | ||||
-rw-r--r-- | test/files/run/t9489/test.scala | 10 |
6 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/t9178a.flags b/test/files/run/t9178a.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/run/t9178a.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/run/t9178a.scala b/test/files/run/t9178a.scala new file mode 100644 index 0000000000..4788841f8d --- /dev/null +++ b/test/files/run/t9178a.scala @@ -0,0 +1,15 @@ +trait Sam { def apply(): Unit } +abstract class Test { + def foo(): Sam + // no parens, instantiateToMethodType would wrap in a `new Sam { def apply = foo }` + // rather than applying to an empty param list() */ + val f: Sam = foo +} + +object Test extends Test { + lazy val samIAm = new Sam { def apply() {} } + def foo() = samIAm + def main(args: Array[String]): Unit = { + assert(f eq samIAm, f) + } +} diff --git a/test/files/run/t9489.flags b/test/files/run/t9489.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/run/t9489.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/run/t9489/A.java b/test/files/run/t9489/A.java new file mode 100644 index 0000000000..c3536faa14 --- /dev/null +++ b/test/files/run/t9489/A.java @@ -0,0 +1,3 @@ +public class A { + public B b() { return null; } +} diff --git a/test/files/run/t9489/B.java b/test/files/run/t9489/B.java new file mode 100644 index 0000000000..e5d1278cd7 --- /dev/null +++ b/test/files/run/t9489/B.java @@ -0,0 +1,3 @@ +public abstract class B { + public abstract int m(); +} diff --git a/test/files/run/t9489/test.scala b/test/files/run/t9489/test.scala new file mode 100644 index 0000000000..1b745af865 --- /dev/null +++ b/test/files/run/t9489/test.scala @@ -0,0 +1,10 @@ +class T { + def f(a: A) = g(a.b) // was: "found Int, required B" + def g(b: => B) = null +} + +object Test extends T { + def main(args: Array[String]): Unit = { + f(new A) + } +} |