alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (tailrec.check)

This example Scala source code file (tailrec.check) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

int, int, tom, tom

The Scala tailrec.check source code

tailrec.scala:45: error: could not optimize @tailrec annotated method facfail: it contains a recursive call not in tail position
    else n * facfail(n - 1)
           ^
tailrec.scala:50: error: could not optimize @tailrec annotated method fail1: it is neither private nor final so can be overridden
  @tailrec def fail1(x: Int): Int = fail1(x)
               ^
tailrec.scala:55: error: could not optimize @tailrec annotated method fail2: it contains a recursive call not in tail position
    case x :: xs  => x :: fail2[T](xs)
                       ^
tailrec.scala:59: error: could not optimize @tailrec annotated method fail3: it is called recursively with different type arguments
  @tailrec final def fail3[T](x: Int): Int = fail3(x - 1)
                                             ^
tailrec.scala:63: error: could not optimize @tailrec annotated method fail4: it changes type of 'this' on a polymorphic recursive call
    @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1)
                                                                    ^
5 errors found

Other Scala examples (source code examples)

Here is a short list of links related to this Scala tailrec.check source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.