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

Splat unfolding not supported in method call syntax

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: PUP 4.0.0
    • Fix Version/s: PUP 3.8.1, PUP 4.1.0
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2015-04-29
    • Release Notes:
      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

            jsd-sla-details-panel

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: