-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.0
-
None
-
-
8cf45b19d5c5c65053a1c41f6293df37947e685d (qt/qtdeclarative/5.15) eb90e8ee3313bee547e6721a2649bf9ba84e3e5c (qt/tqtc-qtdeclarative/6.0)
qmlformat seems to move all function definitions to the top-level, even when they have the same name. This breaks at runtime because of duplicate method name.
Example:
$ cat test.qml
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.2
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
function a() {
function inner() {}
}
function b() {
function inner() {}
}
}
$ qmlformat -i test.qml
$ cat test.qml
import QtQuick 2.12
import QtQuick.Controls 2.2
import QtQuick.Window 2.12
ApplicationWindow {
function a() {
}
function inner() {
}
function b() {
}
function inner() {
}
visible: true
width: 640
height: 480
title: qsTr("Hello World")
}
$ qmlscene test.qml
file:///Users/d.heyman/code/qt-bugs/test.qml:16 Duplicate method name