aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-05 09:51:50 +0100
committerSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-07 16:18:54 +0100
commit4b10e2b7127f3644453a00fe54fec0212614c944 (patch)
treeddc25411d2734004e144d55c9d51231f59d0b795 /tests
parenta50926701ef5171779aa025d2d307751d166cabe (diff)
downloaddotty-4b10e2b7127f3644453a00fe54fec0212614c944.tar.gz
dotty-4b10e2b7127f3644453a00fe54fec0212614c944.tar.bz2
dotty-4b10e2b7127f3644453a00fe54fec0212614c944.zip
Fix #1146: Fix bug of ExpandSAMs with non-apply SAM methods.
When expanding a SAM, ExpandSAMs always used the name `apply` for the generated forwarder, instead of the name of the method which is abstract in the SAM type. This commit fixes this issue.
Diffstat (limited to 'tests')
-rw-r--r--tests/run/non-jvm-sam-non-apply.check1
-rw-r--r--tests/run/non-jvm-sam-non-apply.scala11
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/run/non-jvm-sam-non-apply.check b/tests/run/non-jvm-sam-non-apply.check
new file mode 100644
index 000000000..b8626c4cf
--- /dev/null
+++ b/tests/run/non-jvm-sam-non-apply.check
@@ -0,0 +1 @@
+4
diff --git a/tests/run/non-jvm-sam-non-apply.scala b/tests/run/non-jvm-sam-non-apply.scala
new file mode 100644
index 000000000..e3bfac928
--- /dev/null
+++ b/tests/run/non-jvm-sam-non-apply.scala
@@ -0,0 +1,11 @@
+// shouldn't result in an abstract method error when run
+abstract class NonJVMSam {
+ def foo(x: Int): Int
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val f: NonJVMSam = x => x + 1
+ println(f.foo(3))
+ }
+}