diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-09-09 16:59:43 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-09-09 18:20:01 +0200 |
commit | 24b0711f01dcb410ffd0454881f7a96073f92e16 (patch) | |
tree | da48f345062d67de9a6a344db556253d1d864bbc /test/files/neg/t6276.scala | |
parent | adf2d3632b07eef4fc2303aef994e66584a73f49 (diff) | |
download | scala-24b0711f01dcb410ffd0454881f7a96073f92e16.tar.gz scala-24b0711f01dcb410ffd0454881f7a96073f92e16.tar.bz2 scala-24b0711f01dcb410ffd0454881f7a96073f92e16.zip |
SI-6276 Warn on def or val that trivially loops infinitely
Diffstat (limited to 'test/files/neg/t6276.scala')
-rw-r--r-- | test/files/neg/t6276.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/neg/t6276.scala b/test/files/neg/t6276.scala new file mode 100644 index 0000000000..8333618964 --- /dev/null +++ b/test/files/neg/t6276.scala @@ -0,0 +1,29 @@ +object Test { + def foo(a: Int, b: Int, c: Int) { + new { + def a: Any = a // warn + val b: Any = b // warn + } + + def method { + // method local + def a: Any = a // warn + } + + trait T { + def a: Any + } + + new T { + // inherited return type + def a = a // warn + } + + // no warnings below + new { + def a: Any = {println(""); a} + val b: Any = {println(""); b} + def c(i: Int): Any = c(i - 0) + } + } +} |