groovy
  1. groovy
  2. GROOVY-3343

Allow negative first argument without parentheses

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6-rc-1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      Here's a couple of simple tests to show the bug:

      Here is unit test that fails to run.

      class NegativeParameterWithNoParenthesis extends GroovyTestCase
      {
        def foo(a, b) {}
      
          void testFooWithNegativeParameter()
          {
             foo(-1, 2)
          }
      
      
          void testFooWithNegativeParameterNoParenthesis()
          {
             foo -1, 2
          }
      }
      

      -------------------------------- second test --------------------------------------

      class TestDSL {
       
        def orientation( double azimuth, double elevation ) {
          println("azimuth = " + azimuth + " elevation = " + elevation);
        }
       
        def static process(dsl) {
          def closure = (Closure)new GroovyShell().evaluate("{->" + dsl + "}");
          closure.delegate = new TestDSL();
          closure();
        }
       
      }
      

      here's the dsl file (which I named test.dsl):

      orientation -45.0, 45.0
      

      to run the test:

      TestDSL.process(new File("test.dsl").text);
      

        Activity

        Paul King made changes -
        Field Original Value New Value
        Description Here's a couple of simple tests to show the bug:

        Here is unit test that fails to run.

        class NegativeParameterWithNoParenthesis extends GroovyTestCase
        {
          def foo(a, b) {}


          void testFooWithNegativeParameter()
          {
           foo(-1, 2)
          }


          void testFooWithNegativeParameterNoParenthesis()
          {
           foo -1, 2
          }
        }

        -------------------------------- second test --------------------------------------

        class TestDSL {
         
          def orientation( double azimuth, double elevation ) {
            println("azimuth = " + azimuth + " elevation = " + elevation);
          }
         
          def static process(dsl) {
            def closure = (Closure)new GroovyShell().evaluate("{->" + dsl + "}");
            closure.delegate = new TestDSL();
            closure();
          }
         
        }
         
        here's the dsl file (which I named test.dsl):
         
        orientation -45.0, 45.0
         
         to run the test:
         
              TestDSL.process(new File("test.dsl").text);

        Here's a couple of simple tests to show the bug:

        Here is unit test that fails to run.

        {code}
        class NegativeParameterWithNoParenthesis extends GroovyTestCase
        {
          def foo(a, b) {}

            void testFooWithNegativeParameter()
            {
               foo(-1, 2)
            }


            void testFooWithNegativeParameterNoParenthesis()
            {
               foo -1, 2
            }
        }
        {code}

        -------------------------------- second test --------------------------------------

        {code}
        class TestDSL {
         
          def orientation( double azimuth, double elevation ) {
            println("azimuth = " + azimuth + " elevation = " + elevation);
          }
         
          def static process(dsl) {
            def closure = (Closure)new GroovyShell().evaluate("{->" + dsl + "}");
            closure.delegate = new TestDSL();
            closure();
          }
         
        }
        {code}
         
        here's the dsl file (which I named test.dsl):

        {code}
        orientation -45.0, 45.0
        {code}
         
        to run the test:

        {code}
        TestDSL.process(new File("test.dsl").text);
        {code}
        Pascal Schumacher made changes -
        Summary negative first argument without parentheses fails to run Allow negative first argument without parentheses
        Issue Type Bug [ 1 ] Improvement [ 4 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Burns Boaz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: