QtQml: Resolve composite types for AOT validation via the CU's imports
The runtime validation of lookup signatures tried to find composite
types by guessing the module's location. It completed the module URI
against the import paths, picked the first qrc URL, re-parsed the qmldir
found there, and loaded the type from the file name listed in it. For
modules built with NO_RESOURCE_TARGET_PATH, the QML files and the qmldir
are not at qrc:/qt/qml/<module>/, though. Therefore, the validator could
not find the type, rejected the perfectly valid compilation unit, and
the engine silently fell back to the interpreter.
We don't have to guess. The compilation unit has already resolved all
its imports, and the module of any type it refers to must be among them.
Look up the import by module URI and resolve the type through it. Types
only referenced from script code are resolved, but not necessarily
loaded yet. Load them like QQmlTypeWrapper does.
QQmlTypeLoader::urlsForModule() is not needed anymore.
Amends commit 7abca8275e215eb65cb9066785f3fed1cbbdee16.
Pick-to: 6.12
Fixes: QTBUG-150967
Change-Id: Iab4c98ccee73b69b79e1b6f61df471717aa69f12
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>