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

QmlCompiler unnecessarily generates QJSValue from list operation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.6, 6.7.0 FF
    • 6.5.3
    • QML: Compiler
    • None
    • ae3905531 (dev)

    Description

      Consider:

      pragma Strict
      import QtQml
      
      QtObject {
          property list<QtObject> elms
      
          function remove(elm : QtObject) {
              for (var i = 0; i < elms.length; i++) {
                var value = elms[i];
                if (value != elm) {
                    // TODO: produces QJSValue
                }
              }
          }
      }
      

      This produces:

      OrderedCollection.qml:10: (strict mode) Could not compile function remove: Cannot generate efficient code for incomparable types conversion to QJSValue and conversion to QVariant
      

      There is no reason to generate a QJSValue here, and the right hand side can be a straight QObject*.

      Attachments

        For Gerrit Dashboard: QTBUG-117799
        # Subject Branch Project Status CR V

        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