SI-6754 Support @tailrec for extension methods.

- move the annotation from the class method to the extension method.
 - rewrite recursive calls on in the method body to call the extension
   method.

Review by @paulp