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

Bad Compiler Performance in case of syntax errors when using many subscript operators

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.3.7, 2.5.0-alpha-1, 2.4.10, 3.0.4
    • None
    • Compiler
    • None
    • Windows 7

    Description

      See the following script with a Syntax error (unbalanced parentheses), which repeatedly uses the subscript operator to set something on an object which has the putAt method defined:

      class A {
      	void putAt(key, value) {
      		// whatever
      	}
      }
      
      def a = new A()
      
      a[1] = (
      a[2] = 2
      a[3] = 3
      a[4] = 4
      a[5] = 5
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      a[1] = 0
      

      Expected: The compiler returns with a syntax error.

      Observed: The script takes very long (in the order of minutes) to compile. If it is shortened (remove some of the assignments), at some point it compiles within reasonable time (< 1 Minute), but still slow. The syntax error is reported correctly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aax Ivo Colombo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: