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

Type mismatch describer should merge Enum expectations

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.4.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Language 2016-03-09, Language 2016-03-23
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Type mismatches where the type is an Enum or multiple Enums are now merged to make it easier to figure out what is wrong.

      Description

      A function can be described with different dispatchers for different Enum values. An example of this is the recently introduced type function that uses three different dispatcher where each accepts one Enum choice. At present, this results in a fairly long message when passing something that isn't accepted. Example:

      'type' parameter 'inference_method' expects a match for [#<Puppet::Pops::Types::PEnumType:0x000000032a33b8 @values=["detailed"]>, #<Puppet::Pops::Types::PEnumType:0x00000002e2b718 @values=["reduced"]>, #<Puppet::Pops::Types::PEnumType:0x00000002e16ef8 @values=["generalized"]>], got 'elaborated'  at line 1:8 on node test.example.com
      

      There are two problems here. The first one is that the string representation that the describer uses for the Enum type is out of whack. The second is that it the message would be much clearer if it just mentioned one Enum but with several choices, e.g.

      'type' parameter 'inference_method' expects a match for Enum[detailed,reduced,generalized], got 'elaborated' at line 1:8 on node test.example.com
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support