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

JavaScript function return type list<T> cannot be correctly assigned to prop if annotated

XMLWordPrintable

    • 7fa397156 (dev)

      When return type is annotated, return value from a function like below

          function makeMyCustomTypes(): list<MyCustomType> {
              return [root.myCustomTypeComp.createObject(root, {
                                                             "myPropA": 7
                                                         })]
          } 

      cannot be correctly assigned to a property of same type (list<MyCustomType>). The assignment would always result in:

      [null]

      being set as the value of the property.

       

      Steps to reproduce the issue:

      1. Run the attached project
      2. Observe the output

      Some observations:

      1. The object within the array is of correct type. This can be confirmed with "instanceof MyCustomType).
      2. Removing the return type annotation from the function fixes the issue.
      3. Replacing the return type with e.g. list<BLABLA> seems to work.
      4. Adding "pragma FunctionSignatureBehavior: Ignored" fixes the issue.

       

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

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

              Created:
              Updated:
              Resolved:

                There is 1 open Gerrit change