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

Newline is not sufficient to avoid parsing as a function call

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.2, PUP 4.3.2
    • Fix Version/s: PUP 4.6.0
    • Component/s: Language
    • Labels:
    • Template:
    • Acceptance Criteria:
      Hide

      That an expression in parentheses first on a line will not act as a continuation of the last expression on the preceding line as if it was a function/method name that is being called.
      The following example should not fail.

      $a = []
      ($a).each |$x| { }
      

      Show
      That an expression in parentheses first on a line will not act as a continuation of the last expression on the preceding line as if it was a function/method name that is being called. The following example should not fail. $a = [] ( $a ).each | $x | { }
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2016-07-27
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      When starting a new line with a '(' this would be interpreted as an attempt to continue the last expression on the preceding line as if it was the name of a function to call. This is now changed so that for a '(' to be recognized as a parenthesis opening an argument list it must be placed on the same line as the name of the function. Otherwise it will be taken as the end of the previous expression and starting a new parenthesized/grouping expression.
      Show
      When starting a new line with a '(' this would be interpreted as an attempt to continue the last expression on the preceding line as if it was the name of a function to call. This is now changed so that for a '(' to be recognized as a parenthesis opening an argument list it must be placed on the same line as the name of the function. Otherwise it will be taken as the end of the previous expression and starting a new parenthesized/grouping expression.

      Description

      It looks like starting a line with ( will cause the parser to attempt to match the last "word" of the previous line as a function name.

      (Feel free to change the title of this. I couldn't figure out how to make it clearer.)

      Broken test case

      $a = []
      ([]).each |$n| { }
      

      Expected results: A successful run.
      Actual results: Error: Could not parse for environment production: Illegal expression. An Array Expression is unacceptable as function name in a Function Call at /Users/daniel/work/masterless/test.pp:1:6 on node zhora.local

      Working test case

      $a = [] ;
      ([]).each |$n| { }
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  qa qa
                  Reporter:
                  daniel.parks Daniel Parks
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: