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

Resource parameter validation uses TypeCalculator.infer instead of infer_set

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: PUP 3.8.0, PUP 4.0.0
    • Fix Version/s: PUP 3.8.1, PUP 4.1.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      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

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  thomas.hallgren Thomas Hallgren
                  QA Contact:
                  Kurt Wall
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: