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

Numbers as properties in command expressions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-rc-3
    • Fix Version/s: 2.6.0-alpha-1
    • Component/s: parser
    • Labels:
      None

      Description

      It is allowed not to surround numbers with quotes in command expressions if they are used as properties.
      Is it bug or feature?

      def get123() {2}
      def foo(i) {this}
      
      def a = foo(2).'123'
      def b = foo 2   123
      
      println a
      println b
      

      But if you rename get123() to get123a() the line will throw an exception.

      def b = foo 2   123a
      

        Activity

        Hide
        daniel_sun Daniel Sun added a comment -

        Fixed in the parrot branch

        Show
        daniel_sun Daniel Sun added a comment - Fixed in the parrot branch
        Hide
        paulk Paul King added a comment -

        Daniel, I can't see any change in behavior related to this if I understand correctly. Is there something you had in mind? Otherwise, shouldn't this really just be closed without a fix version and marked as a "feature".

        Show
        paulk Paul King added a comment - Daniel, I can't see any change in behavior related to this if I understand correctly. Is there something you had in mind? Otherwise, shouldn't this really just be closed without a fix version and marked as a "feature".

          People

          • Assignee:
            daniel_sun Daniel Sun
            Reporter:
            mxm-groovy Maxim Medvedev
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development