-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Done
-
Affects Version/s: 5.15.0, 6.0
-
Fix Version/s: None
-
Component/s: QML: Tooling
-
Labels:None
-
Commits:ac68310b7857693c9eb7ccb782133ac9ec8e2328 (qt/qtdeclarative/dev)
See simplified version of code bellow.
qmlformat from "dev" and qmlformat from 5.15 prints:
Failed to parse formatted code. An error has occurred. Aborting.
If I add curly brackets around outer "if", qmlformat can handle this code,
but only once.
import QtQuick 2.0 Item { function f(x, y) { if (x && y) if (x < y) return 0; else return -1; else return y; } }
I mean if add:
import QtQuick 2.0 Item { function f(x, y) { if (x && y) { if (x < y) return 0; else return -1; } else { return y; } } }
qmlformat can parse this code,
but it removes "{" that fixed this code,
so if you run qmlformat -i test.qml , the second run failed.
For Gerrit Dashboard: QTBUG-86060 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
310387,2 | qmlformat: fix handling of "if else" inside "if" in "if else" | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |