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

Function signatures are insufficiently enforced

XMLWordPrintable

    • b7f4779cc (dev), 8bf5aae19 (dev)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes