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

Unable to declare variable with identifier equal to function name inside getter

    XMLWordPrintable

Details

    • b3fe31a0ff129bb87f81901f2f50c0041b8f4a80 (qt/qtdeclarative/dev) 2805015ebd93c9e5e64825cb21e4d23724a78b28 (qt/qtdeclarative/6.2)

    Description

      class Tester {
          constructor () {
             this.a = 1;
             this.b = 1;
          }
      
         get sum() {
             const sum = this.a + this.b;
             return sum;
          }
       }
      

      This will error with the message:

      Identifier sum has already been declared
                   const sum = this.a + this.b;
      

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            brizental Beatriz Rizental
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes