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

LiteralString class parameters get parsed with positioning information that includes a negative length

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 3.6.1
    • PUP 3.7.0
    • Compiler

    Description

      When using the future parser, any class parameter with a LiteralString value receive positioning information with a negative length:

      # param_test.rb
      require 'puppet'
      require 'puppet/pops'
       
      parser = Puppet::Pops::Parser::Parser.new
       
      result = parser.parse_string <<-EOM
      class test::class (
        $param_one = undef,
        $param_two = 'some string',
        $param_three = true,
        $param_four = 'another string',
        $param_five = $some::varaible::somewhere, 
      ) {}
      EOM
       
      result.current.definitions.each do |d|
        d.parameters.each do |p|
          puts "#{p.name}: #{p.value.length}"
        end
      end
      

      # ruby param_test.rb
      param_one: 5
      param_two: -13
      param_three: 4
      param_four: -16
      param_five: 26
      

      This prevents SourcePosAdapters attached to these object from being fully functional.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support