From fd5bcea5f64001ad03794a0468fbb3dcdebba0fe Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 15 Jun 2022 14:57:51 +0200 Subject: [PATCH] QmlJS: Enhance member lookup Check for the alias when performing a member lookup on an import. Fixes: QTCREATORBUG-26714 Change-Id: If3febb7d6de9fa2663cdda0143d4aa3590312ca5 Reviewed-by: Ulf Hermann --- src/libs/qmljs/qmljsinterpreter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 74526295813..9412406fdc4 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2378,8 +2378,12 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context continue; if (const Value *v = import->lookupMember(name, context, foundInObject)) { - i.used = true; - return v; + // FIXME if we have multiple non-aliased imports containing this object we'd have to + // disambiguate (and inform the user) about this issue + if (info.as().isEmpty()) { + i.used = true; + return v; + } } } if (foundInObject)