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

[Reg 6.6 -> 6.7] Optional chaining+ nullish coalescing leads to uncompilable code

    XMLWordPrintable

Details

    • 72308ce20 (dev), 5250a2d99 (6.7)

    Description

      This code

      import QtQuick
      
      QtObject {
          id: win
      
          component Foo: QtObject {
              property int progress: 0
          }
      
          property int progress: 0
          readonly property Foo configuring: Foo {}
      
          Component.onCompleted: {
              win.configuring.progress = win?.progress ?? 0
          }
      }
      

      leads to

      /home/prcs1076/tmp/build-optional-Desktop_Qt_6_7_0_64-Debug/.rcc/qmlcache/appoptional_Main_qml.cpp:278:53: error: cannot convert ‘QVariant’ to ‘const QJSPrimitiveValue&’
        278 | r2_5 = QJSPrimitiveValue(QJSPrimitiveNull()).equals(r2_4);
            |                                                     ^~~~
            |                                                     |
            |                                                     QVariant
      In file included from /var/home/prcs1076/Qt/6.7.0/gcc_64/include/QtQml/qqmlprivate.h:18,
                       from /home/prcs1076/tmp/build-optional-Desktop_Qt_6_7_0_64-Debug/.rcc/qmlcache/appoptional_Main_qml.cpp:2:
      /var/home/prcs1076/Qt/6.7.0/gcc_64/include/QtQml/qjsprimitivevalue.h:445:52: note:   initializing argument 1 of ‘constexpr bool QJSPrimitiveValue::equals(const QJSPrimitiveValue&) const’
        445 |     constexpr bool equals(const QJSPrimitiveValue &other) const
            |                           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
      ninja: build stopped: subcommand failed.
      

      .

      Attachments

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

        Activity

          People

            olivier.decanniere Olivier De Cannière
            cajus Cajus Pollmeier
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes