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

Resource parameter validation uses TypeCalculator.infer instead of infer_set

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Done
    • PUP 3.8.0, PUP 4.0.0
    • PUP 3.8.1, PUP 4.1.0
    • None
    • None
    • 1
    • Language 2015-05-13, Language 2015-05-27

    Description

      Type TypeCalculator.infer is used when type constrained resource parameters are validated which means that important information is lost when an error message is printed. The following expression:

      define foo(Struct[{b => Integer, d=>String}] $a) { notice $a }
      foo{ bar: a => {b => 5, c => 'stuff'}}
      

      currently results in the following error message:

      Error: Expected parameter 'a' of 'Foo[bar]' to have type Struct[{'b'=>Integer, 'd'=>String}], got Hash[String, Scalar]
      

      the correct output (when using `infer_set` instead of `infer`) should be:

      Error: Expected parameter 'a' of 'Foo[bar]' to have type Struct[{'b'=>Integer, 'd'=>String}], got Struct[{'b'=>Integer, 'c'=>String}]
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              thomas.hallgren Thomas Hallgren
              Kurt Wall Kurt Wall
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support