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

Bad error for unresolved type in 4.x function API

    XMLWordPrintable

    Details

    • Type: Bug
    • 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:
      Not Needed
    • Release Notes Summary:
      bug in not yet released feature.

      Description

      When making a typo in a 4.x function (or using an alias that cannot be loaded), when calling the function, an error like this is displayed:

      Error while evaluating a Function Call, 'then' parameter 'arg' expects a TypeReference value, got String
      

      (The function's name in this example is called 'then', and it uses a type 'MyAny' with the intent that there should be an alias like MyAny = Any.

      Instead of giving an error when calling the method, it resulted in an expectancy of a TypeReference.

      Seems a failed type resolution is not reported in this case.

      Function reproducing the problem:

      Puppet::Functions.create_function(:then) do
        dispatch :then do
          repeated_param 'MyAny', :arg
          block_param
        end
       
        def then(*args)
          yield(*args)
        end
      end
      

      Ans calling it like this:

      puppet apply -e 'then(all_you_need_is_love) |$x| { notice $x }'
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              henrik.lindberg Henrik Lindberg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support