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

Empty LiteralHash and LiteralList parameters get parsed with positioning information that excludes their closing delimiter

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 3.7.3
    • PUP 3.7.4
    • Compiler
    • 1
    • Language 2015-01-21

    Description

      Reproduction Case

      # literal_test.rb
      require 'puppet'
      require 'puppet/pops'
       
      parser = Puppet::Pops::Parser::Parser.new
        
      result = parser.parse_string <<-EOM
      class test::class (
        $param_one = {},
        $param_two = { },
        $param_three = {a => b},
        $param_four = [],
        $param_five = [ ],
        $param_six = [a],
      ) {}
      EOM
       
      result.current.definitions.each do |d|
        d.parameters.each do |p|
          puts "#{p.name}: #{p.value.length}"
        end
      end
      

      Outcome

      # ruby literal_test.rb 
      param_one: 1
      param_two: 1
      param_three: 8
      param_four: 1
      param_five: 1
      param_six: 3
      

      Expected Outcome

      Params one and four get parsed with a length of 2 and params two and five get a length of 3.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chuck Charlie Sharpsteen
              Kurt Wall Kurt Wall
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support