Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119885

Function signatures are insufficiently enforced

    XMLWordPrintable

Details

    • b7f4779cc (dev), 8bf5aae19 (dev)

    Description

      Consider:

      import QtQml
      
      QtObject {
          id: mainItem
          function a(item: Binding) : QtObject { return item }
          Component.onCompleted: console.log(a(mainItem));
      }
      

      This correctly prints 'null' when interpreted, but it prints the object when compiled. This is because the type for item cannot be expressed at compile time. We would need to use private API or construct the metatype from name.

      It follows that we cannot use the QMetaTypes stored in the CU for enforcement of type annotations. We rather have to use the names like we do for the JS-to-JS coercion.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ulherman Ulf Hermann
              ulherman Ulf Hermann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes