diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-21 18:11:51 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-08-21 18:11:51 -0700 |
commit | b67fecd0f178ea70e4fa9823c408e52437426403 (patch) | |
tree | 165cc7db3b12393d55c99b05b23cb7c64c20567d /test | |
parent | f315253ff7c5f4074f61a079308db45452be75db (diff) | |
parent | 6634d82f74b71dd36ca1ecceea08b4ad79335da0 (diff) | |
download | scala-b67fecd0f178ea70e4fa9823c408e52437426403.tar.gz scala-b67fecd0f178ea70e4fa9823c408e52437426403.tar.bz2 scala-b67fecd0f178ea70e4fa9823c408e52437426403.zip |
Merge pull request #2852 from retronym/ticket/1980-warning
SI-1980 A lint warning for by-name parameters in right assoc methods
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t1980.check | 12 | ||||
-rw-r--r-- | test/files/neg/t1980.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t1980.scala | 9 |
3 files changed, 22 insertions, 0 deletions
diff --git a/test/files/neg/t1980.check b/test/files/neg/t1980.check new file mode 100644 index 0000000000..2fa27fa462 --- /dev/null +++ b/test/files/neg/t1980.check @@ -0,0 +1,12 @@ +t1980.scala:2: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980. + def op1_:(x: => Any) = () // warn + ^ +t1980.scala:3: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980. + def op2_:(x: Any, y: => Any) = () // warn + ^ +t1980.scala:4: warning: by-name parameters will be evaluated eagerly when called as a right-associative infix operator. For more details, see SI-1980. + def op3_:(x: Any, y: => Any)(a: Any) = () // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t1980.flags b/test/files/neg/t1980.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/neg/t1980.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/neg/t1980.scala b/test/files/neg/t1980.scala new file mode 100644 index 0000000000..132865e694 --- /dev/null +++ b/test/files/neg/t1980.scala @@ -0,0 +1,9 @@ +object Test { + def op1_:(x: => Any) = () // warn + def op2_:(x: Any, y: => Any) = () // warn + def op3_:(x: Any, y: => Any)(a: Any) = () // warn + + def op4() = () // no warn + def op5(x: => Any) = () // no warn + def op6_:(x: Any)(a: => Any) = () // no warn +} |