Where i can read implement of annotation @tailrec

The only thing i can see is
final class tailrec extends scala.annotation.StaticAnnotation
I want to look up for the implementation of this annotation

It’s probably treated similarly to e.g. java.lang.Override in Java compiler. You have to look up handling of scala.annotation.tailrec in the Scala compiler sources.

1 Like

Hi @tarsa thanks for answering my question but can you be more specific for example where is the file or the link that i can read the implement of this cause i am using find file in github and have no idea how to get it.

https://github.com/scala/scala/blob/v2.13.1/src/reflect/scala/reflect/internal/Definitions.scala#L1271 contains:

lazy val TailrecClass = requiredClass[scala.annotation.tailrec]

That’s then used e.g. in https://github.com/scala/scala/blob/v2.13.1/src/compiler/scala/tools/nsc/transform/TailCalls.scala

def isMandatory = method.hasAnnotation(TailrecClass)
1 Like

Thanks a lot @tarsa