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

Qmlformat makes code uncompilable when destructuring objects in lambda expressions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.4, 6.5
    • 6.5.2
    • QML: Tooling
    • None
    • 729edeb34 (6.5)

    Description

      Qmlformat removes the parameterlist from a lambda expression

      import QtQuick
      
      Item {
          function test(object){
                      object.forEach(([]) => {
                      
                      })
          }
          width: ({})=>{}
      }
       

      Gets formatted to:

      import QtQuick
      
      Item {
          function test(object) {
              object.forEach([ => {})
          }
                              width: { => {}
                              }
       

      as you can see the [ is never closed and the code would never compile after formatting

      The same happens when you use {} instead of []

      This could be related to QTBUG-111511

      Attachments

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

        Activity

          People

            semih.yavuz Semih Yavuz
            lucienp Lucien Paraton
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes