Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4398

Splat unfolding not supported in method call syntax

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Done
    • PUP 4.0.0
    • PUP 3.8.1, PUP 4.1.0
    • Language
    • None
    • Bug Fix

    Description

      I expected the following to be equivalent:

      Function call sytnax:

      with(*[1, 2, 3]) |$x, $y, $z| {
          notice $x, $y, $z
      }
      

      Method call syntax:

      (*[1, 2, 3]).with |$x, $y, $z| {
          notice $x, $y, $z
      }
      

      The function call outputs:

      Notice: Scope(Class[main]): 1 2 3
      

      The method call outputs an error:

      Error: Evaluation Error: Parameter $y is required but no value was given at...
      

      In the latter, $x is the array without being unfolded.

      Note: I could not find a workaround in the syntax to be able to splat for a method call.

      risk: medium
      probability: low (unfolding IN arrays/method calls/etc)
      severity: medium (no work arounds other than using different class function structure)
      test layer: unit

      Attachments

        Activity

          People

            Unassigned Unassigned
            peter.huene Peter Huene
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support