diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 6ada52f13f6..129ae8d0b2d 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -411,11 +411,6 @@ class UnresolvedDotExpr : public Expr { SourceLoc DotLoc; Identifier Name; SourceLoc NameLoc; - - /// ResolvedDecl - If the name refers to any local or top-level declarations, - /// the name binder fills them in here. - ArrayRef ResolvedDecls; - public: UnresolvedDotExpr(Expr *subexpr, SourceLoc dotloc, Identifier name, SourceLoc nameloc) @@ -441,12 +436,6 @@ public: Identifier getName() const { return Name; } SourceLoc getNameLoc() const { return NameLoc; } - ArrayRef getResolvedDecls() const { return ResolvedDecls; } - void setResolvedDecls(ArrayRef Decls) { - assert(ResolvedDecls.empty()); - ResolvedDecls = Decls; - } - // Implement isa/cast/dyncast/etc. static bool classof(const UnresolvedDotExpr *) { return true; } static bool classof(const Expr *E) { diff --git a/include/swift/AST/Module.h b/include/swift/AST/Module.h index c2c72aaaa02..1b041aebdb2 100644 --- a/include/swift/AST/Module.h +++ b/include/swift/AST/Module.h @@ -37,8 +37,7 @@ namespace swift { /// by various query methods. enum class NLKind { UnqualifiedLookup, - QualifiedLookup, - DotLookup + QualifiedLookup }; /// Module - A unit of modularity. The current translation unit is a diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 9c03e072465..b10d379c265 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -723,9 +723,6 @@ public: void visitUnresolvedDotExpr(UnresolvedDotExpr *E) { OS.indent(Indent) << "(unresolved_dot_expr type='" << E->getType(); OS << "\' field '" << E->getName().str() << "'"; - if (!E->getResolvedDecls().empty()) - OS << " decl resolved to " << E->getResolvedDecls().size() - << " candidate(s)!"; if (E->getBase()) { OS << '\n'; printRec(E->getBase()); diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index e0af2f54e16..548c8bbd1a7 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -157,13 +157,8 @@ void TUModuleCache::lookupValue(AccessPathTy AccessPath, Identifier Name, if (I == TopLevelValues.end()) return; Result.reserve(I->second.size()); - for (ValueDecl *Elt : I->second) { - // Dot Lookup ignores values with non-function types. - if (LookupKind == NLKind::DotLookup && !Elt->getType()->is()) - continue; - + for (ValueDecl *Elt : I->second) Result.push_back(Elt); - } } //===----------------------------------------------------------------------===// diff --git a/lib/Sema/NameBinding.cpp b/lib/Sema/NameBinding.cpp index 37a892cd23f..88d84a711b6 100644 --- a/lib/Sema/NameBinding.cpp +++ b/lib/Sema/NameBinding.cpp @@ -217,23 +217,10 @@ static Expr *BindNames(Expr *E, WalkOrder Order, NameBinder &Binder) { if (Order == WalkOrder::PreOrder) return E; - // A reference to foo.bar may be an application ("bar foo"), so look up bar. - // It may also be a tuple field reference, so don't report an error here if we - // don't find anything juicy. - if (UnresolvedDotExpr *UDE = dyn_cast(E)) { - SmallVector Decls; - // Perform .-style name lookup. - Binder.TU->lookupGlobalValue(UDE->getName(), NLKind::DotLookup, Decls); - - // Copy the overload set into ASTContext memory. - if (!Decls.empty()) - UDE->setResolvedDecls(Binder.Context.AllocateCopy(Decls)); - return UDE; - } - Identifier Name; SourceLoc Loc; SmallVector Decls; + // Process UnresolvedDeclRefExpr by doing an unqualified lookup. if (UnresolvedDeclRefExpr *UDRE = dyn_cast(E)) { Name = UDRE->getName(); diff --git a/lib/Sema/TypeCheckExpr.cpp b/lib/Sema/TypeCheckExpr.cpp index 14c0923e198..ca382f3b56a 100644 --- a/lib/Sema/TypeCheckExpr.cpp +++ b/lib/Sema/TypeCheckExpr.cpp @@ -439,33 +439,6 @@ Expr *SemaExpressionTree::visitUnresolvedDotExpr(UnresolvedDotExpr *E) { return Call; } - // Next, check to see if "a.f" is actually being used as sugar for "f a", - // which is a function application of 'a' to 'f'. - if (!E->getResolvedDecls().empty()) { - assert(E->getResolvedDecls()[0]->getType()->is() && - "Should have only bound to functions"); - Expr *FnRef; - // Apply the base value to the function there is a single candidate in the - // set then this is directly resolved, otherwise it is an overload case. - if (E->getResolvedDecls().size() == 1) - FnRef = new (TC.Context) DeclRefExpr(E->getResolvedDecls()[0], - E->getNameLoc(), - E->getResolvedDecls()[0]->getTypeJudgement()); - else { - FnRef = new (TC.Context) OverloadSetRefExpr(E->getResolvedDecls(), - E->getNameLoc()); - FnRef->setDependentType(DependentType::get(TC.Context)); - } - - CallExpr *Call = new (TC.Context) CallExpr(FnRef, Base, - /*DotSyntax=*/true, - TypeJudgement()); - if (TC.semaApplyExpr(Call)) - return 0; - - return Call; - } - // If this is a member access to a oneof with a single element constructor // (e.g. a struct), allow direct access to the type underlying the single // element.