aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsfunctioninitializer.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2025-01-22 16:16:26 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2025-01-24 16:01:03 +0100
commit1b9d4c66ff62bb9d6dcc7c1a181788931dc26b2f (patch)
treeb75683be36944cf1dfd4ccf470427d68abf10a34 /src/qmlcompiler/qqmljsfunctioninitializer.cpp
parent89dc227e7cf838b69314f87b4c7e6e00c87904fa (diff)
Qml: Fix import order for certain name resolutions
When two modules provide types with the same name, the one from the last import should take precedence. This was not the case for certain types of lookups. Some would prefer the first import to provide a name while others would prefer the last one. This went unnoticed until 12fb7d27431a7db2a19e1954c85d5dc03264b356 moved method resolution from runtime to compile time in the compiler. An assert intended to ensure that the function selected at compile time still exists was then triggered because the lookup rules differed between the compile and run times. One would use the type from the first import and the other the one from the last import leading to the mismatch in relative method index that triggered the assert. To fix this, simply read the modules from the type name cache back in the reverse order to align with the rest of the resolution logics. This affected singletons, attached types and as-casts. [ChangeLog][QtQml][Important Behavior Changes] When a type name is provided by two different imports, the type from the last import takes precedence. This is now also the case when resolving singletons, attached types, and types for as-casts. This aligns with the behavior for regular type resolution. Fixes: QTBUG-132921 Pick-to: 6.9 6.8 6.5 Change-Id: I5e127a9b1bedcbfef0fb4a36471bdf0ff6d74ec9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
0 files changed, 0 insertions, 0 deletions