Details
-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
6.8
-
None
Description
Currently, qmltc does not try to find and load qmllint plugins when compiling. For example, lets say a qml file has an invalid quick type, and qmllint warns about it when it loads the quick plugin: if qmltc is run on the same file, it will internally run the linter without the plugins (and will not get the warning that one of the quick types is invalid) and will then attempt to compile an invalid QML file, leading potentially to generating incorrect code.
An example of this is in https://codereview.qt-project.org/c/qt/qtdeclarative/+/514494 in the tst_qmltc_qprocess:constructFromString test that is QEXPECT_FAIL.
Currently, qmltc is not aware of value type constructors, for example it does not know how to construct the quick vector type:Main.qml currently (current 6.8 snapshot) gives:
FAILED: .qmltc/appuntitled63/main.h .qmltc/appuntitled63/main.cpp /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.qmltc/appuntitled63/main.h /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.qmltc/appuntitled63/main.cpp cd /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug && /Applications/CMake.app/Contents/bin/cmake -E make_directory /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.qmltc/appuntitled63 && /Users/sami/Qt/6.8.0/macos/bin/qmltc --bare --header /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.qmltc/appuntitled63/main.h --impl /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.qmltc/appuntitled63/main.cpp --namespace untitled63 -i /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/untitled63/qmldir -I /Users/sami/Qt/6.8.0/macos/./qml --resource /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.rcc/qmake_untitled63.qrc --resource /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/.rcc/appuntitled63_raw_qml_0.qrc --meta-resource /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/untitled63/appuntitled63_qml_module_dir_map.qrc --resource /Users/sami/tmp/untitled63/build/Qt_6_8_0_for_macOS-Debug/untitled63/.qmltc/appuntitled63/appuntitled63_qmltc_file_map.qrc /Users/sami/tmp/untitled63/Main.qml Detected locale "C" with character encoding "US-ASCII", which is not UTF-8. Qt depends on a UTF-8 locale, and has switched to "UTF-8" instead. If this causes problems, reconfigure your locale. See the locale(1) manual for more information. Error: /Users/sami/tmp/untitled63/Main.qml:16:27: Cannot assign literal of type string to QVector4D [incompatible-type] property vector4d p7: "1,2,3,4" ^^^^^^^^^ Error: /Users/sami/tmp/untitled63/Main.qml:17:28: Cannot assign literal of type string to QMatrix4x4 [incompatible-type] property matrix4x4 p8: "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: /Users/sami/tmp/untitled63/Main.qml:15:27: Cannot assign literal of type string to QVector3D [incompatible-type] property vector3d p6: "1,2,3" ^^^^^^^ Error: /Users/sami/tmp/untitled63/Main.qml:13:29: Cannot assign literal of type string to QQuaternion [incompatible-type] property quaternion p2: "1,2,3,4" ^^^^^^^^^ Error: /Users/sami/tmp/untitled63/Main.qml:14:27: Cannot assign literal of type string to QVector2D [incompatible-type] property vector2d p5: "1,2"
while the engine can run this code.
Attachments
Issue Links
- resulted from
-
QTBUG-118323 qmllint: produce warnings for string to valuetype conversions
- Open