Details
Description
When the javascript in the undefined.qml file is compiled and executed, the call to Math.max() returns 40 whereas it should return NaN.
AFAIK, this is due to the fact that the undefined value is handled as a 0.0 double instead of being coerced into a NaN as expected (mdn) as can be seen in the generated C++ code:
// generate_LoadUndefined
r2_1 = 0.0;
Replacing "Math.max(undefined, 40)" with "Math.max(Number(undefined), 40)" or "Math.max(new Number(undefined), 40)"correctly performs the coercion to NaN.
Attachments
For Gerrit Dashboard: QTBUG-111179 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
460555,7 | QmlCompiler: Fix coercion of undefined to float and double | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
461672,4 | QmlCompiler: Fix coercion of undefined to float and double | 6.4 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
461673,2 | QmlCompiler: Fix coercion of undefined to float and double | 6.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
461744,4 | QtQml: Fix coercion of undefined to float and double | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
461935,2 | Fix coercion of undefined to float and double | tqtc/lts-6.2 | qt/tqtc-qmlcompilerplus | Status: MERGED | +2 | 0 |