diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-07-28 15:08:43 -0700 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-08-10 13:51:56 +0200 |
commit | 43ba65fa11456899b3c45be14bd3895d8d6b6b5a (patch) | |
tree | af6f3122e7f8dbb12431840c5a440e763269f478 /test/files/neg | |
parent | 2b172be8c83c3146d3fd5ab01546c171ab18fa46 (diff) | |
download | scala-43ba65fa11456899b3c45be14bd3895d8d6b6b5a.tar.gz scala-43ba65fa11456899b3c45be14bd3895d8d6b6b5a.tar.bz2 scala-43ba65fa11456899b3c45be14bd3895d8d6b6b5a.zip |
SI-7187 deprecate eta-expansion of zero-arg method values
For backwards compatiblity with 2.11, we already
don't adapt a zero-arg method value to a SAM.
In 2.13, we won't do any eta-expansion for zero-arg method values,
but we should deprecate first.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t7187.check | 6 | ||||
-rw-r--r-- | test/files/neg/t7187.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t7187.scala | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/test/files/neg/t7187.check b/test/files/neg/t7187.check new file mode 100644 index 0000000000..a30803c746 --- /dev/null +++ b/test/files/neg/t7187.check @@ -0,0 +1,6 @@ +t7187.scala:3: warning: Eta-expansion of zero-argument method values is deprecated. Did you intend to write EtaExpandZeroArg.this.foo()? + val f: () => Any = foo + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t7187.flags b/test/files/neg/t7187.flags new file mode 100644 index 0000000000..c6bfaf1f64 --- /dev/null +++ b/test/files/neg/t7187.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings diff --git a/test/files/neg/t7187.scala b/test/files/neg/t7187.scala new file mode 100644 index 0000000000..45d33f06af --- /dev/null +++ b/test/files/neg/t7187.scala @@ -0,0 +1,6 @@ +class EtaExpandZeroArg { + def foo(): () => String = () => "" + val f: () => Any = foo + + // f() would evaluate to <function0> instead of "" +} |