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

Alias properties incorrectly allow duplicating property names

    XMLWordPrintable

Details

    • 28d133a8a779f9bf1432a6003456b62f74b3c492 (qt/qtdeclarative/dev) 1c6ddb892d7570728e6a9d07b572a2a8e3defb36 (qt/qtdeclarative/6.2)

    Description

      Look at the following code:

      import QtQuick 2.6
      
      Item {
          property alias currentText: myText.text
          readonly property string currentText: myText.text
          //readonly property string currentText: myText.text
      
          Text {
              id: myText
              text: "hello"
          }
      }
      

      Note that it defines currentText twice. Once as an alias, once as a property. Notice that it runs without error, which already seems very questionable/wrong.

      Then uncomment the second declaration, and notice that it does correctly error in that case:

      test.qml:6 Duplicate property name

      Attachments

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

        Activity

          People

            fabiankosmale Fabian Kosmale
            w00t Robin Burchell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews