Dotty: Compiler ignores @tailrec if inline is present

Created on 2 Jan 2021  路  1Comment  路  Source: lampepfl/dotty

Minimized code

scala> import scala.annotation.tailrec
scala> @tailrec inline def foo() = ???

Output

def foo(): Nothing

Expectation

An error, as in

scala> @tailrec def bar() = ???                                                                                              
1 |@tailrec def bar() = ???
  |             ^
  |TailRec optimisation not applicable, method bar contains no recursive calls
bug

Most helpful comment

Or: forbid combination of tailRec and inline.

>All comments

Or: forbid combination of tailRec and inline.

Was this page helpful?
0 / 5 - 0 ratings