diff --git a/frontend/lib/resolution/Resolver.cpp b/frontend/lib/resolution/Resolver.cpp index 5430abe3f2ed..f1adad14e7b6 100644 --- a/frontend/lib/resolution/Resolver.cpp +++ b/frontend/lib/resolution/Resolver.cpp @@ -2996,10 +2996,10 @@ void Resolver::resolveIdentifier(const Identifier* ident) { auto parenlessInfo = ParenlessOverloadInfo(); auto ids = lookupIdentifier(ident, resolvingCalledIdent, parenlessInfo); - // If we looked up a called identifier and got no method results, - // repeat lookup for the identifier as though it wasn't called, to support - // implicit 'this' calls. - if (resolvingCalledIdent && !ids.isEmpty()) { + // If we looked up a called identifier and found ambiguity but no method + // results, repeat lookup for the identifier as though it wasn't called, to + // support implicit 'this' calls. + if (resolvingCalledIdent && ids.numIds() > 1) { bool anyMethod = false; for (auto idIt = ids.begin(); idIt != ids.end(); ++idIt) { if (idIt.curIdAndFlags().isMethod()) {