Open
Description
Consider the following code
@tailrec
val gcd: (Int, Int) => Int = {
case (a,b) if (a == b) => a
case (a,b) if (a > b) => gcd (a-b,b)
case (a,b) if (b > a) => gcd (a, b-a)
}
Expected result: either the gcd function is optimized into a loop or the compiler warns about @tailrec not being applied on vals
Actual result: the function is not optimized and no warning is raised by the compiler
This is confusing and it should be made explicit somehow. See http://stackoverflow.com/questions/24892624/how-to-ensure-tail-recursion-consistently for an example of unexpected behavior.