diff options
Diffstat (limited to 'test/files/neg/tailrec-4.scala')
-rw-r--r-- | test/files/neg/tailrec-4.scala | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/files/neg/tailrec-4.scala b/test/files/neg/tailrec-4.scala new file mode 100644 index 0000000000..4822799dfa --- /dev/null +++ b/test/files/neg/tailrec-4.scala @@ -0,0 +1,35 @@ +import annotation._ + +object Tail { + def tcInFunc: Unit = { + () => { + @tailrec def foo: Int = foo + 1 + } + } + def tcInBooleanExprFirstOp(x: Int, v: Int): Boolean = { + { + @tailrec def foo: Int = foo + 1 + foo + } == v && true + } + def tcInBooleanExprSecondOp(x: Int, v: Int): Boolean = { + true && { + @tailrec def foo: Int = foo + 1 + foo + } == v + } + def tcInIfCond(x: Int, v: Int): Boolean = { + if ({ + @tailrec def foo: Int = foo + 1 + foo + } == v) true else false + } + def tcInPatternGuard(x: Int, v: Int): Boolean = + v match { + case _ if + { + @tailrec def foo: Int = foo + 1 + foo == 42 + } => true + } +} |