Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6573

TailRecursive creates compilation error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • None
    • 2.3.0-beta-1
    • None
    • None
    • Debian Sid (aka Unstable), Groovy master 48b650edd3473cdcfe8b1f11667f005bd2bbaf92 using indy artefacts.

    Description

      The code:

      @TailRecursive
        private static BigInteger iterate(final BigInteger i, final BigInteger a, final BigInteger b) {
          i < 1 ? a : iterate(i - 1, b, a + b)
        }
      

      compiles and works fine with the @TailRecursive commented out. With it in place:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      file:/home/users/russel/Progs/Applications/Fibonacci/Groovy/Fibonacci.groovy: 43: Apparent variable '__b__' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes:
      You attempted to reference a variable in the binding or an instance variable from a static context.
      You misspelled a classname or statically imported field. Please check the spelling.
      You attempted to use a method '__b__' but left out brackets in a place not allowed by the grammar.
       @ line 43, column 32.
             i < 1 ? a : iterate(i - 1, b, a + b)
                                        ^
      
      1 error
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            russel Dr. Russel Winder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: