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

Type validation fails when validating hashes using a struct type.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: PUP 3.7.5
    • Component/s: Compiler
    • Labels:
      None
    • Template:
    • Story Points:
      2
    • Sprint:
      Language 2015-02-04, Language 2015-02-18

      Description

      When using the following type:

      Struct[{'mode'=>String, 'path'=>Array[String]}]
      

      it should be legal to pass the following hash

      { 'mode' => 'read', 'path' => ['foo', 'fee'] }
      

      but this fails because the inferred type of the hash is:

      Hash[Variant[String, String], Variant[String, Tuple[String, String]]]
      

      which is considered incompatible, and correctly so.

      The solution is probably to let infer_set reduce the type of each pair in the hash rather than attempting to combine the reduced type of all keys with the reduced type of all values. The pair semantics must be retained during reduction in order to guarantee that the result is assignable to a struct.

        Attachments

          Issue Links

            Activity

              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:

                  Zendesk Support