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

NamedVariant: default value overrides supplied value if it's falsy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.16, 3.0.10, 4.0.0
    • 2.5.16, 3.0.10, 4.0.1
    • None

    Description

      Consider the following:

      @groovy.transform.NamedVariant
      def m(int one, int two = 42) {
          "$one $two"
      }
      String result = m(one:0, two:0)
      assert result == '0 0' // fails
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h