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

remove compiler errors for deferred function mismatched types

    XMLWordPrintable

Details

    • Story
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 7.17.0
    • None
    • Hide

      Compilations don't error with deferred functions

      Show
      Compilations don't error with deferred functions
    • Phoenix
    • 3
    • Phoenix 2022-05-11, Phoenix 2022-05-25
    • Bug Fix
    • Hide
      Before this fix, it was not possible to compile a catalog that used a `Deferred` value for a typed parameter class; the compiler would error with a message stating that the type expected did not match `Deferred`. With this fix, the compiler will inspect the Deferred class's return type and ensure it matches the class parameter type. If the Deferred function has no return type, the compiler will warn that it cannot guarantee the type will adhere to the type the class specifies.
      Show
      Before this fix, it was not possible to compile a catalog that used a `Deferred` value for a typed parameter class; the compiler would error with a message stating that the type expected did not match `Deferred`. With this fix, the compiler will inspect the Deferred class's return type and ensure it matches the class parameter type. If the Deferred function has no return type, the compiler will warn that it cannot guarantee the type will adhere to the type the class specifies.
    • Needs Assessment

    Description

      Usage of a deferred function will fail compilation when used as typed parameter value when requiring a class. The compiler will error on a mismatch of the parameter type and the yet-to-be-resolved deferred function.

      Functions can have their return type specified, which can then be tested to match the parameter type. Many functions do not specify their return_type though, so in that scenario the compiler should clearly warn that the compiler cannot guarantee the correctness of the return value of the function.

      Attachments

        Activity

          People

            tony.vu Tony Vu
            david.mctavish David McTavish
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support