diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-11-17 13:20:30 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-12-14 10:04:47 -0800 |
commit | 582c8a2fdd1d5b3cacff982b0c4af0a7dd37b651 (patch) | |
tree | 7c9a86656b17a1c715c87ad92a634dc2fb4f8af5 /test/files/neg | |
parent | b91b415b4fccfc46520dcd3f128b4b09d19d74f0 (diff) | |
download | scala-582c8a2fdd1d5b3cacff982b0c4af0a7dd37b651.tar.gz scala-582c8a2fdd1d5b3cacff982b0c4af0a7dd37b651.tar.bz2 scala-582c8a2fdd1d5b3cacff982b0c4af0a7dd37b651.zip |
SI-10068 Only permit elidable methods
In refchecks, check that symbol with `@elidable` is a method.
When eliding in uncurry, doublecheck.
The check is enabled under `-Xsource:2.13`.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t10068.check | 13 | ||||
-rw-r--r-- | test/files/neg/t10068.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t10068.scala | 9 |
3 files changed, 23 insertions, 0 deletions
diff --git a/test/files/neg/t10068.check b/test/files/neg/t10068.check new file mode 100644 index 0000000000..2bb27c4fd8 --- /dev/null +++ b/test/files/neg/t10068.check @@ -0,0 +1,13 @@ +t10068.scala:5: error: i : Only methods can be marked @elidable. + @elidable(INFO) val i: Int = 42 + ^ +t10068.scala:6: error: j: Only methods can be marked @elidable. + @elidable(INFO) lazy val j: Int = 42 + ^ +t10068.scala:7: error: k : Only methods can be marked @elidable. + @elidable(INFO) var k: Int = 42 + ^ +t10068.scala:9: error: D: Only methods can be marked @elidable. +@elidable(INFO) class D + ^ +four errors found diff --git a/test/files/neg/t10068.flags b/test/files/neg/t10068.flags new file mode 100644 index 0000000000..2b18795468 --- /dev/null +++ b/test/files/neg/t10068.flags @@ -0,0 +1 @@ +-Xelide-below WARNING -Xsource:2.13 diff --git a/test/files/neg/t10068.scala b/test/files/neg/t10068.scala new file mode 100644 index 0000000000..a45ee5dac4 --- /dev/null +++ b/test/files/neg/t10068.scala @@ -0,0 +1,9 @@ + +import annotation._, elidable._ + +class C { + @elidable(INFO) val i: Int = 42 + @elidable(INFO) lazy val j: Int = 42 + @elidable(INFO) var k: Int = 42 +} +@elidable(INFO) class D |