diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2016-04-18 22:12:06 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2016-04-18 22:12:06 +0200 |
commit | ca47bea3eed87eaa6005161c831805cd68fd6e59 (patch) | |
tree | d745e164566a422b71347bb36513a4e8f306161a /tests | |
parent | d4589a4c337a37fbac29449c3a8fb6a7dad85c66 (diff) | |
download | dotty-ca47bea3eed87eaa6005161c831805cd68fd6e59.tar.gz dotty-ca47bea3eed87eaa6005161c831805cd68fd6e59.tar.bz2 dotty-ca47bea3eed87eaa6005161c831805cd68fd6e59.zip |
Test #1221.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/tailcall/i1221.scala | 10 | ||||
-rw-r--r-- | tests/pos/tailcall/i1221.scala | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/neg/tailcall/i1221.scala b/tests/neg/tailcall/i1221.scala new file mode 100644 index 000000000..5c3286e97 --- /dev/null +++ b/tests/neg/tailcall/i1221.scala @@ -0,0 +1,10 @@ +import annotation.tailrec + +object Test{ + final def foo(a: Int): Int = { + if ((foo(a - 1): @tailrec) > 0) // error: not in tail position + foo(a - 1): @tailrec + else + foo(a - 2): @tailrec + } +} diff --git a/tests/pos/tailcall/i1221.scala b/tests/pos/tailcall/i1221.scala new file mode 100644 index 000000000..80dcfdc4b --- /dev/null +++ b/tests/pos/tailcall/i1221.scala @@ -0,0 +1,10 @@ +import annotation.tailrec + +object Test{ + final def foo(a: Int): Int = { + if (foo(a - 1) > 0) + foo(a - 1): @tailrec + else + foo(a - 2): @tailrec + } +} |