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

qmlsc confuses precedence between properties and IDs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 6.2.2, 6.3
    • Fix Version/s: 6.2.3, 6.2, 6.3.0 Alpha, 6.3
    • Component/s: QML: Compiler
    • Labels:
      None
    • Commits:
      7d911956b9074184898c26c12f1280a98eadfc04 (qt/qtdeclarative/dev) 298ffa496d32eeaf997b65d89a389115edbf0e0e (qt/qtdeclarative/6.2)

      Description

      import QtQuick
      
      Item {
          objectName: "id"
          id: a
      
          Item {
              id: b
              objectName: "b"
          }
      
          Component {
              id: handle
              Item {
                  property Item a: Item { objectName: "property" }
      
                  objectName: a.objectName
                  Component.onCompleted: console.log(objectName, a.objectName, b.objectName)
              }
          }
      
          Component.onCompleted: handle.createObject()
      }
      

      Should print "qml: property property b". Instead it crashes. qmlsc fails in two related ways here:

      1. The ID 'a' is preferred over the property 'a'. It should be the other way around
      2. When looking up the ID 'a' (or 'b' for that matter), it only looks in the context hierarchy of the inner Component. There, it doesn't find it and crashes.

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes