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

Output of iterator type results in unhandled exception

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 4.4.0
    • PUP 4.4.2
    • None
    • None
    • Bug Fix
    • if an attempt was made to call a function (e.g. notice) with the result of a call to a function that produces an Iterator (e.g. reverse_each) the operation would fail. Now the iterator is transformed to an array in those cases.

    Description

      The following manifest:

      notice([1,2,3].reverse_each)
      

      results in:

      Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `mod_types' for #<Puppet::Pops::Types::PVariantType:0x007fdcee20ae68> at /Users/peterhuene/.puppetlabs/etc/code/environments/production/manifests/site.pp:1:1 on node peterhu-osx
      

      This should obviously not produce an error.

      Personally, I'd expect an iterator to display an array representation of the iteration sequence unless it's iterating over a hash, which should probably be represented as a hash.

      Thus the expected output would be:

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

      The native compiler has decided that the output of an iterator displays an array/hash of the sequence without actually constructing one.

      ACCEPTANCE CRITERIA


      notice([1,2,3].reverse_each)
      

      Should notice

      [3, 2, 1]
      

      Attachments

        Issue Links

          Activity

            People

              john.duarte John Duarte
              peter.huene Peter Huene
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support