diff --git a/docs/CompilerPerformance.md b/docs/CompilerPerformance.md index 97b23bb429b21..d898fa8cfeb21 100644 --- a/docs/CompilerPerformance.md +++ b/docs/CompilerPerformance.md @@ -570,7 +570,7 @@ compilers on hand while you're working. Total Execution Time: 0.0876 seconds (0.0877 wall clock) ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name --- - 0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Name binding + 0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Import resolution 0.0170 ( 38.0%) 0.0025 ( 5.8%) 0.0195 ( 22.3%) 0.0195 ( 22.2%) Type checking / Semantic analysis 0.0013 ( 3.0%) 0.0004 ( 0.8%) 0.0017 ( 1.9%) 0.0017 ( 1.9%) LLVM output 0.0010 ( 2.3%) 0.0003 ( 0.7%) 0.0013 ( 1.5%) 0.0013 ( 1.5%) SILGen diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 1c1e85b656832..619503200980a 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -650,7 +650,7 @@ ERROR(cannot_return_value_from_void_func,none, "unexpected non-void return value in void function", ()) //------------------------------------------------------------------------------ -// MARK: Name Binding +// MARK: Import Resolution //------------------------------------------------------------------------------ ERROR(sema_no_import,Fatal, diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h index 59500a36d3844..6513825b9949e 100644 --- a/include/swift/AST/Expr.h +++ b/include/swift/AST/Expr.h @@ -1319,9 +1319,9 @@ class SuperRefExpr : public Expr { } }; -/// A reference to a type in expression context, spelled out as a TypeLoc. Sema -/// forms this expression as a result of name binding. This always has -/// MetaTypetype. +/// A reference to a type in expression context, spelled out as a TypeLoc. +/// +/// The type of this expression is always \c MetaTypeType. class TypeExpr : public Expr { TypeLoc Info; TypeExpr(Type Ty); @@ -4675,7 +4675,7 @@ class AssignExpr : public Expr { }; /// A pattern production that has been parsed but hasn't been resolved -/// into a complete pattern. Name binding converts these into standalone pattern +/// into a complete pattern. Pattern checking converts these into standalone pattern /// nodes or raises an error if a pattern production appears in an invalid /// position. class UnresolvedPatternExpr : public Expr { diff --git a/include/swift/AST/ImportCache.h b/include/swift/AST/ImportCache.h index 37705f4fba9cc..90ea89bc3b4ec 100644 --- a/include/swift/AST/ImportCache.h +++ b/include/swift/AST/ImportCache.h @@ -148,7 +148,7 @@ class alignas(ModuleDecl::ImportedModule) ImportCache { const DeclContext *dc); /// This is a hack to cope with main file parsing and REPL parsing, where - /// we can add ImportDecls after name binding. + /// we can add ImportDecls after import resolution. void clear() { ImportSetForDC.clear(); } diff --git a/include/swift/AST/SourceFile.h b/include/swift/AST/SourceFile.h index 60f1f7e48ea3d..267a00e441c38 100644 --- a/include/swift/AST/SourceFile.h +++ b/include/swift/AST/SourceFile.h @@ -78,7 +78,7 @@ class SourceFile final : public FileUnit { /// This is the list of modules that are imported by this module. /// - /// This is filled in by the Name Binding phase. + /// This is filled in by the import resolution phase. ArrayRef Imports; /// A unique identifier representing this file; used to mark private decls @@ -172,13 +172,10 @@ class SourceFile final : public FileUnit { /// List of Objective-C member conflicts we have found during type checking. std::vector ObjCMethodConflicts; - template - using OperatorMap = llvm::DenseMap>; - - OperatorMap InfixOperators; - OperatorMap PostfixOperators; - OperatorMap PrefixOperators; - OperatorMap PrecedenceGroups; + llvm::DenseMap InfixOperators; + llvm::DenseMap PostfixOperators; + llvm::DenseMap PrefixOperators; + llvm::DenseMap PrecedenceGroups; /// Describes what kind of file this is, which can affect some type checking /// and other behavior. @@ -189,8 +186,8 @@ class SourceFile final : public FileUnit { Parsing, /// Parsing has completed. Parsed, - /// Name binding has completed. - NameBound, + /// Import resolution has completed. + ImportsResolved, /// Type checking has completed. TypeChecked }; diff --git a/include/swift/AST/TypeRepr.h b/include/swift/AST/TypeRepr.h index 97ad28965718b..856d1f48e6a71 100644 --- a/include/swift/AST/TypeRepr.h +++ b/include/swift/AST/TypeRepr.h @@ -263,7 +263,7 @@ class ComponentIdentTypeRepr : public IdentTypeRepr { /// component. /// /// The initial parsed representation is always an identifier, and - /// name binding will resolve this to a specific declaration. + /// name lookup will resolve this to a specific declaration. llvm::PointerUnion IdOrDecl; /// The declaration context from which the bound declaration was diff --git a/include/swift/AST/Types.h b/include/swift/AST/Types.h index 739bd98d19fe1..20692ca14a8d6 100644 --- a/include/swift/AST/Types.h +++ b/include/swift/AST/Types.h @@ -1204,10 +1204,11 @@ class NominalOrBoundGenericNominalType : public AnyGenericType { }; DEFINE_EMPTY_CAN_TYPE_WRAPPER(NominalOrBoundGenericNominalType, AnyGenericType) -/// ErrorType - This represents a type that was erroneously constructed. This -/// is produced when parsing types and when name binding type aliases, and is -/// installed in declaration that use these erroneous types. All uses of a -/// declaration of invalid type should be ignored and not re-diagnosed. +/// ErrorType - Represents the type of an erroneously constructed declaration, +/// expression, or type. When creating ErrorTypes, an associated error +/// diagnostic should always be emitted. That way when later stages of compilation +/// encounter an ErrorType installed by earlier phases they do not have to +/// emit further diagnostics to abort compilation. class ErrorType final : public TypeBase { friend class ASTContext; // The Error type is always canonical. @@ -5643,11 +5644,11 @@ inline ArrayRef AnyFunctionType::getParams() const { llvm_unreachable("Undefined function type"); } } - + /// If this is a method in a type or extension thereof, compute /// and return a parameter to be used for the 'self' argument. The type of /// the parameter is the empty Type() if no 'self' argument should exist. This -/// can only be used after name binding has resolved types. +/// can only be used after types have been resolved. /// /// \param isInitializingCtor Specifies whether we're computing the 'self' /// type of an initializing constructor, which accepts an instance 'self' diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index c779245b70358..3e73312ef96a7 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -588,7 +588,7 @@ class CompilerInstance { void performParseOnly(bool EvaluateConditionals = false, bool ParseDelayedBodyOnEnd = false); - /// Parses and performs name binding on all input files. + /// Parses and performs import resolution on all input files. /// /// Like a parse-only invocation, a single file is required. Unlike a /// parse-only invocation, module imports will be processed. diff --git a/include/swift/Parse/Scope.h b/include/swift/Parse/Scope.h index 2fb49bf112d42..a202cbc48ee73 100644 --- a/include/swift/Parse/Scope.h +++ b/include/swift/Parse/Scope.h @@ -168,7 +168,7 @@ inline ValueDecl *ScopeInfo::lookupValueName(DeclName Name) { assert(CurScope && "no scope"); // If we found nothing, or we found a decl at the top-level, return nothing. // We ignore results at the top-level because we may have overloading that - // will be resolved properly by name binding. + // will be resolved properly by name lookup and overload resolution. std::pair Res = HT.lookup(CurScope->HTScope, Name); if (Res.first < ResolvableDepth) return 0; diff --git a/include/swift/Subsystems.h b/include/swift/Subsystems.h index 31d37c8695e40..437cd84de6b88 100644 --- a/include/swift/Subsystems.h +++ b/include/swift/Subsystems.h @@ -150,23 +150,23 @@ namespace swift { /// Once parsing is complete, this walks the AST to resolve imports, record /// operators, and do other top-level validation. /// - /// \param StartElem Where to start for incremental name binding in the main + /// \param StartElem Where to start for incremental import and operator resolution in the main /// source file. - void performNameBinding(SourceFile &SF, unsigned StartElem = 0); + void resolveImportsAndOperators(SourceFile &SF, unsigned StartElem = 0); /// Once type-checking is complete, this instruments code with calls to an /// intrinsic that record the expected values of local variables so they can /// be compared against the results from the debugger. void performDebuggerTestingTransform(SourceFile &SF); - /// Once parsing and name-binding are complete, this optionally transforms the + /// Once parsing and type checking are complete, this optionally transforms the /// ASTs to add calls to external logging functions. /// /// \param HighPerformance True if the playground transform should omit /// instrumentation that has a high runtime performance impact. void performPlaygroundTransform(SourceFile &SF, bool HighPerformance); - /// Once parsing and name-binding are complete this optionally walks the ASTs + /// Once parsing and type checking are complete this optionally walks the ASTs /// to add calls to externally provided functions that simulate /// "program counter"-like debugging events. void performPCMacro(SourceFile &SF, TopLevelContext &TLC); @@ -201,7 +201,7 @@ namespace swift { /// \returns a reference to the type checker instance. TypeChecker &createTypeChecker(ASTContext &Ctx); - /// Once parsing and name-binding are complete, this walks the AST to resolve + /// Once parsing and preliminary import resolution are complete, this walks the AST to resolve /// types and diagnose problems therein. /// /// \param StartElem Where to start for incremental type-checking in the main diff --git a/lib/AST/ASTVerifier.cpp b/lib/AST/ASTVerifier.cpp index 07e006da90e2a..87cb3dd5cb77d 100644 --- a/lib/AST/ASTVerifier.cpp +++ b/lib/AST/ASTVerifier.cpp @@ -420,7 +420,7 @@ class Verifier : public ASTWalker { verifyParsed(node); // If we've bound names already, verify as a bound node. - if (!SF || SF->ASTStage >= SourceFile::NameBound) + if (!SF || SF->ASTStage >= SourceFile::ImportsResolved) verifyBound(node); // If we've checked types already, do some extra verification. diff --git a/lib/AST/Module.cpp b/lib/AST/Module.cpp index 8985872b71897..02ac1d3084e8b 100644 --- a/lib/AST/Module.cpp +++ b/lib/AST/Module.cpp @@ -656,9 +656,7 @@ void ModuleDecl::getPrecedenceGroups( void SourceFile::getPrecedenceGroups( SmallVectorImpl &Results) const { for (auto pair : PrecedenceGroups) { - if (pair.second.getPointer() && pair.second.getInt()) { - Results.push_back(pair.second.getPointer()); - } + Results.push_back(pair.second); } } @@ -891,9 +889,6 @@ ProtocolConformanceRef ModuleDecl::lookupConformance(Type type, } namespace { - template - using OperatorMap = SourceFile::OperatorMap; - template struct OperatorLookup { // Don't fold this into the static_assert: this would trigger an MSVC bug @@ -968,10 +963,10 @@ void SourceFile::setSyntaxRoot(syntax::SourceFileSyntax &&Root) { SyntaxInfo->SyntaxRoot.emplace(Root); } -template -static Optional -lookupOperatorDeclForName(ModuleDecl *M, SourceLoc Loc, Identifier Name, - OperatorMap SourceFile::*OP_MAP); +template +static Optional lookupOperatorDeclForName( + ModuleDecl *M, SourceLoc Loc, Identifier Name, + llvm::DenseMap SourceFile::*OP_MAP); template using ImportedOperatorsMap = llvm::SmallDenseMap; @@ -1019,12 +1014,10 @@ checkOperatorConflicts(const SourceFile &SF, SourceLoc loc, // Returns None on error, Optional(nullptr) if no operator decl found, or // Optional(decl) if decl was found. -template -static Optional -lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc, Identifier Name, - bool includePrivate, - OperatorMap SourceFile::*OP_MAP) -{ +template +static Optional lookupOperatorDeclForName( + FileUnit &File, SourceLoc Loc, Identifier Name, bool includePrivate, + llvm::DenseMap SourceFile::*OP_MAP) { switch (File.getKind()) { case FileUnitKind::Builtin: // The Builtin module declares no operators. @@ -1038,12 +1031,12 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc, Identifier Name, } auto &SF = cast(File); - assert(SF.ASTStage >= SourceFile::NameBound); + assert(SF.ASTStage >= SourceFile::ImportsResolved); // Look for an operator declaration in the current module. auto found = (SF.*OP_MAP).find(Name); - if (found != (SF.*OP_MAP).end() && (includePrivate || found->second.getInt())) - return found->second.getPointer(); + if (found != (SF.*OP_MAP).end()) + return found->second; // Look for imported operator decls. // Record whether they come from re-exported modules. @@ -1070,13 +1063,12 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc, Identifier Name, importedOperators[op] |= isExported; } - typename OperatorMap::mapped_type result = { nullptr, true }; - + OP_DECL *result = nullptr; if (!importedOperators.empty()) { auto start = checkOperatorConflicts(SF, Loc, importedOperators); if (start == importedOperators.end()) return None; - result = { start->first, start->second }; + result = start->first; } if (includePrivate) { @@ -1084,22 +1076,20 @@ lookupOperatorDeclForName(const FileUnit &File, SourceLoc Loc, Identifier Name, // It's not safe to cache the non-private results because we didn't search // private imports there, but in most non-private cases the result will // be cached in the final lookup. - auto &mutableOpMap = const_cast &>(SF.*OP_MAP); - mutableOpMap[Name] = result; + (SF.*OP_MAP)[Name] = result; } - if (includePrivate || result.getInt()) - return result.getPointer(); + if (includePrivate) + return result; return nullptr; } -template -static Optional -lookupOperatorDeclForName(ModuleDecl *M, SourceLoc Loc, Identifier Name, - OperatorMap SourceFile::*OP_MAP) -{ +template +static Optional lookupOperatorDeclForName( + ModuleDecl *M, SourceLoc Loc, Identifier Name, + llvm::DenseMap SourceFile::*OP_MAP) { OP_DECL *result = nullptr; - for (const FileUnit *File : M->getFiles()) { + for (FileUnit *File : M->getFiles()) { auto next = lookupOperatorDeclForName(*File, Loc, Name, false, OP_MAP); if (!next.hasValue()) return next; @@ -1113,31 +1103,31 @@ lookupOperatorDeclForName(ModuleDecl *M, SourceLoc Loc, Identifier Name, return result; } -#define LOOKUP_OPERATOR(Kind) \ -Kind##Decl * \ -ModuleDecl::lookup##Kind(Identifier name, SourceLoc loc) { \ - auto result = lookupOperatorDeclForName(this, loc, name, \ - &SourceFile::Kind##s); \ - return result ? *result : nullptr; \ -} \ -Kind##Decl * \ -SourceFile::lookup##Kind(Identifier name, bool isCascading, SourceLoc loc) { \ - auto result = lookupOperatorDeclForName(*this, loc, name, true, \ - &SourceFile::Kind##s); \ - if (!result.hasValue()) \ - return nullptr; \ - if (ReferencedNames) {\ - if (!result.getValue() || \ - result.getValue()->getDeclContext()->getModuleScopeContext() != this) {\ - ReferencedNames->addTopLevelName(name, isCascading); \ - } \ - } \ - if (!result.getValue()) { \ - result = lookupOperatorDeclForName(getParentModule(), loc, name, \ - &SourceFile::Kind##s); \ - } \ - return result.hasValue() ? result.getValue() : nullptr; \ -} +#define LOOKUP_OPERATOR(Kind) \ + Kind##Decl *ModuleDecl::lookup##Kind(Identifier name, SourceLoc loc) { \ + auto result = \ + lookupOperatorDeclForName(this, loc, name, &SourceFile::Kind##s); \ + return result ? *result : nullptr; \ + } \ + Kind##Decl *SourceFile::lookup##Kind(Identifier name, bool isCascading, \ + SourceLoc loc) { \ + auto result = lookupOperatorDeclForName(*this, loc, name, true, \ + &SourceFile::Kind##s); \ + if (!result.hasValue()) \ + return nullptr; \ + if (ReferencedNames) { \ + if (!result.getValue() || \ + result.getValue()->getDeclContext()->getModuleScopeContext() != \ + this) { \ + ReferencedNames->addTopLevelName(name, isCascading); \ + } \ + } \ + if (!result.getValue()) { \ + result = lookupOperatorDeclForName(getParentModule(), loc, name, \ + &SourceFile::Kind##s); \ + } \ + return result.hasValue() ? result.getValue() : nullptr; \ + } LOOKUP_OPERATOR(PrefixOperator) LOOKUP_OPERATOR(InfixOperator) diff --git a/lib/AST/UnqualifiedLookup.cpp b/lib/AST/UnqualifiedLookup.cpp index 14e93a83199dc..04de2fee5cae9 100644 --- a/lib/AST/UnqualifiedLookup.cpp +++ b/lib/AST/UnqualifiedLookup.cpp @@ -1390,7 +1390,7 @@ bool UnqualifiedLookupFactory::shouldDiffer() const { "swift/test/TypeCoercion/overload_noncall.swift", "swift/test/expr/capture/nested_class.swift", "swift/test/expr/capture/order.swift", - "swift/test/NameBinding/name-binding.swift" + "swift/test/ImportResolution/name-binding.swift" }; StringRef fileName = SF->getFilename(); return llvm::any_of(testsThatShouldDiffer, [&](const char *testFile) { diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 2382e79d3f70f..0acae5da398fa 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -657,7 +657,7 @@ shouldImplicityImportSwiftOnoneSupportModule(CompilerInvocation &Invocation) { } void CompilerInstance::performParseAndResolveImportsOnly() { - performSemaUpTo(SourceFile::NameBound); + performSemaUpTo(SourceFile::ImportsResolved); } void CompilerInstance::performSema() { @@ -837,12 +837,12 @@ void CompilerInstance::parseAndCheckTypesUpTo( auto *SF = dyn_cast(File); if (!SF) return true; - return SF->ASTStage >= SourceFile::NameBound; + return SF->ASTStage >= SourceFile::ImportsResolved; }) && "some files have not yet had their imports resolved"); MainModule->setHasResolvedImports(); - // If the limiting AST stage is name binding, we're done. - if (limitStage <= SourceFile::NameBound) { + // If the limiting AST stage is import resolution, we're done. + if (limitStage <= SourceFile::ImportsResolved) { return; } @@ -900,7 +900,7 @@ void CompilerInstance::parseLibraryFile( Diags.setSuppressWarnings(DidSuppressWarnings); - performNameBinding(*NextInput); + resolveImportsAndOperators(*NextInput); } OptionSet CompilerInstance::computeTypeCheckingOptions() { @@ -981,8 +981,8 @@ void CompilerInstance::parseAndTypeCheckMainFileUpTo( case SourceFile::Parsing: case SourceFile::Parsed: llvm_unreachable("invalid limit stage"); - case SourceFile::NameBound: - performNameBinding(MainFile, CurTUElem); + case SourceFile::ImportsResolved: + resolveImportsAndOperators(MainFile, CurTUElem); break; case SourceFile::TypeChecked: const auto &options = Invocation.getFrontendOptions(); @@ -1007,7 +1007,7 @@ void CompilerInstance::parseAndTypeCheckMainFileUpTo( } if (!mainIsPrimary) { - performNameBinding(MainFile); + resolveImportsAndOperators(MainFile); } } diff --git a/lib/IDE/CodeCompletion.cpp b/lib/IDE/CodeCompletion.cpp index 94596247d10d0..cbe3795851a07 100644 --- a/lib/IDE/CodeCompletion.cpp +++ b/lib/IDE/CodeCompletion.cpp @@ -3318,23 +3318,19 @@ class CompletionLookup final : public swift::VisibleDeclConsumer { } template - void collectOperatorsFromMap(SourceFile::OperatorMap &map, - bool includePrivate, + void collectOperatorsFromMap(llvm::DenseMap &map, std::vector &results) { for (auto &pair : map) { - if (pair.second.getPointer() && - (pair.second.getInt() || includePrivate)) { - results.push_back(pair.second.getPointer()); - } + if (auto *op = pair.second) + results.push_back(op); } } void collectOperatorsFrom(SourceFile *SF, std::vector &results) { - bool includePrivate = CurrDeclContext->getParentSourceFile() == SF; - collectOperatorsFromMap(SF->PrefixOperators, includePrivate, results); - collectOperatorsFromMap(SF->PostfixOperators, includePrivate, results); - collectOperatorsFromMap(SF->InfixOperators, includePrivate, results); + collectOperatorsFromMap(SF->PrefixOperators, results); + collectOperatorsFromMap(SF->PostfixOperators, results); + collectOperatorsFromMap(SF->InfixOperators, results); } void collectOperatorsFrom(LoadedFile *F, diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index dc8448c88de0c..4d04cc6417528 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -46,8 +46,8 @@ ParserResult Parser::parseExprImpl(Diag<> Message, SyntaxParsingContext ExprParsingContext(SyntaxContext, SyntaxContextKind::Expr); // If we are parsing a refutable pattern, check to see if this is the start - // of a let/var/is pattern. If so, parse it to an UnresolvedPatternExpr and - // name binding will perform final validation. + // of a let/var/is pattern. If so, parse it as an UnresolvedPatternExpr and + // let pattern type checking determine its final form. // // Only do this if we're parsing a pattern, to improve QoI on malformed // expressions followed by (e.g.) let/var decls. diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 9923d1c9cdc69..ef40fcf3954fc 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -222,12 +222,11 @@ bool Parser::isTerminatorForBraceItemListKind(BraceItemListKind Kind, } case BraceItemListKind::TopLevelCode: // When parsing the top level executable code for a module, if we parsed - // some executable code, then we're done. We want to process (name bind, - // type check, etc) decls one at a time to make sure that there are not - // forward type references, etc. There is an outer loop around the parser - // that will reinvoke the parser at the top level on each statement until - // EOF. In contrast, it is ok to have forward references between classes, - // functions, etc. + // some executable code, then we're done. We want to process decls one at a + // time to make sure that there are not forward type references, etc. There + // is an outer loop around the parser that will reinvoke the parser at the + // top level on each statement until EOF. In contrast, it is ok to have + // forward references between classes, functions, etc. for (auto I : ParsedDecls) { if (isa(I.get())) // Only bail out if the next token is at the start of a line. If we diff --git a/lib/ParseSIL/ParseSIL.cpp b/lib/ParseSIL/ParseSIL.cpp index de34626cd11e3..ab4fb8bb37d0a 100644 --- a/lib/ParseSIL/ParseSIL.cpp +++ b/lib/ParseSIL/ParseSIL.cpp @@ -1154,7 +1154,6 @@ static bool parseDeclSILOptional(bool *isTransparent, bool SILParser::performTypeLocChecking(TypeLoc &T, bool IsSILType, GenericEnvironment *GenericEnv, DeclContext *DC) { - // Do some type checking / name binding for the parsed type. assert(P.SF.ASTStage == SourceFile::Parsing && "Unexpected stage during parsing!"); diff --git a/lib/Sema/CMakeLists.txt b/lib/Sema/CMakeLists.txt index 847f5d6150254..72b5c1054a510 100644 --- a/lib/Sema/CMakeLists.txt +++ b/lib/Sema/CMakeLists.txt @@ -32,10 +32,10 @@ add_swift_host_library(swiftSema STATIC InstrumenterSupport.cpp LookupVisibleDecls.cpp MiscDiagnostics.cpp - NameBinding.cpp PCMacro.cpp PlaygroundTransform.cpp ResilienceDiagnostics.cpp + ResolveImports.cpp SourceLoader.cpp TypeCheckAccess.cpp TypeCheckAttr.cpp diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index c61e9fbf22590..cf180d6f689a4 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -2786,8 +2786,8 @@ namespace { } Type visitUnresolvedPatternExpr(UnresolvedPatternExpr *expr) { - // If there are UnresolvedPatterns floating around after name binding, - // they are pattern productions in invalid positions. However, we will + // If there are UnresolvedPatterns floating around after pattern type + // checking, they are definitely invalid. However, we will // diagnose that condition elsewhere; to avoid unnecessary noise errors, // just plop an open type variable here. diff --git a/lib/Sema/ConstraintSystem.h b/lib/Sema/ConstraintSystem.h index 72ca78949f254..ab67ec0fe065a 100644 --- a/lib/Sema/ConstraintSystem.h +++ b/lib/Sema/ConstraintSystem.h @@ -1797,8 +1797,8 @@ class ConstraintSystem { /// system, to avoid. /// /// FIXME: This caching should almost certainly be performed at the - /// module level, since type checking occurs after name binding, - /// and no new names are introduced after name binding. + /// module level, since type checking occurs after import resolution, + /// and no new names are introduced after that point. /// /// \returns A reference to the member-lookup result. LookupResult &lookupMember(Type base, DeclName name); diff --git a/lib/Sema/NameBinding.cpp b/lib/Sema/ResolveImports.cpp similarity index 80% rename from lib/Sema/NameBinding.cpp rename to lib/Sema/ResolveImports.cpp index 4d17b4eefc760..ba9d3d96cce1e 100644 --- a/lib/Sema/NameBinding.cpp +++ b/lib/Sema/ResolveImports.cpp @@ -1,4 +1,4 @@ -//===--- NameBinding.cpp - Name Binding -----------------------------------===// +//===--- ResolveImports.cpp - Import Resolution ---------------------------===// // // This source file is part of the Swift.org open source project // @@ -10,7 +10,8 @@ // //===----------------------------------------------------------------------===// // -// This file implements name binding for Swift. +// This file implements import resolution and collects operator and precedence +// group declarations. // //===----------------------------------------------------------------------===// @@ -33,40 +34,37 @@ #include "llvm/Support/SaveAndRestore.h" #include #include -using namespace swift; -//===----------------------------------------------------------------------===// -// NameBinder -//===----------------------------------------------------------------------===// +using namespace swift; using ImportedModule = ModuleDecl::ImportedModule; using ImportOptions = SourceFile::ImportOptions; -namespace { - class NameBinder { - public: - SourceFile &SF; - ASTContext &Context; +namespace { +class ImportResolver { +public: + SourceFile &SF; + ASTContext &Context; - NameBinder(SourceFile &SF) : SF(SF), Context(SF.getASTContext()) {} + ImportResolver(SourceFile &SF) : SF(SF), Context(SF.getASTContext()) {} - template - InFlightDiagnostic diagnose(ArgTypes &&...Args) { - return Context.Diags.diagnose(std::forward(Args)...); - } + template + InFlightDiagnostic diagnose(ArgTypes &&... Args) { + return Context.Diags.diagnose(std::forward(Args)...); + } - void addImport(SmallVectorImpl &imports, - ImportDecl *ID); + void addImport(SmallVectorImpl &imports, + ImportDecl *ID); - /// Load a module referenced by an import statement. - /// - /// Returns null if no module can be loaded. - ModuleDecl *getModule(ArrayRef> ModuleID); - }; + /// Load a module referenced by an import statement. + /// + /// Returns null if no module can be loaded. + ModuleDecl *getModule(ArrayRef> ModuleID); +}; } // end anonymous namespace -ModuleDecl * -NameBinder::getModule(ArrayRef> modulePath) { +ModuleDecl *ImportResolver::getModule( + ArrayRef> modulePath) { assert(!modulePath.empty()); auto moduleID = modulePath[0]; @@ -168,7 +166,7 @@ static bool shouldImportSelfImportClang(const ImportDecl *ID, return false; } -void NameBinder::addImport( +void ImportResolver::addImport( SmallVectorImpl &imports, ImportDecl *ID) { if (ID->getModulePath().front().first == SF.getParentModule()->getName() && ID->getModulePath().size() == 1 && !shouldImportSelfImportClang(ID, SF)) { @@ -354,55 +352,39 @@ void NameBinder::addImport( } } -//===----------------------------------------------------------------------===// -// performNameBinding -//===----------------------------------------------------------------------===// - -template -static void insertOperatorDecl(NameBinder &Binder, - SourceFile::OperatorMap &Operators, +template +static void insertOperatorDecl(ImportResolver &resolver, + llvm::DenseMap &Operators, OP_DECL *OpDecl) { auto previousDecl = Operators.find(OpDecl->getName()); if (previousDecl != Operators.end()) { - Binder.diagnose(OpDecl->getLoc(), diag::operator_redeclared); - Binder.diagnose(previousDecl->second.getPointer(), - diag::previous_operator_decl); + resolver.diagnose(OpDecl->getLoc(), diag::operator_redeclared); + resolver.diagnose(previousDecl->second, diag::previous_operator_decl); return; } - // FIXME: The second argument indicates whether the given operator is visible - // outside the current file. - Operators[OpDecl->getName()] = { OpDecl, true }; + Operators[OpDecl->getName()] = OpDecl; } -static void insertPrecedenceGroupDecl(NameBinder &binder, SourceFile &SF, +static void insertPrecedenceGroupDecl(ImportResolver &resolver, SourceFile &SF, PrecedenceGroupDecl *group) { auto previousDecl = SF.PrecedenceGroups.find(group->getName()); if (previousDecl != SF.PrecedenceGroups.end()) { - binder.diagnose(group->getLoc(), diag::precedence_group_redeclared); - binder.diagnose(previousDecl->second.getPointer(), - diag::previous_precedence_group_decl); + resolver.diagnose(group->getLoc(), diag::precedence_group_redeclared); + resolver.diagnose(previousDecl->second, + diag::previous_precedence_group_decl); return; } - // FIXME: The second argument indicates whether the given precedence - // group is visible outside the current file. - SF.PrecedenceGroups[group->getName()] = { group, true }; + SF.PrecedenceGroups[group->getName()] = group; } -/// performNameBinding - Once parsing is complete, this walks the AST to -/// resolve names and do other top-level validation. -/// -/// At this point parsing has been performed, but we still have -/// UnresolvedDeclRefExpr nodes for unresolved value names, and we may have -/// unresolved type names as well. This handles import directives and forward -/// references. -void swift::performNameBinding(SourceFile &SF, unsigned StartElem) { - SharedTimer timer("Name binding"); +void swift::resolveImportsAndOperators(SourceFile &SF, unsigned StartElem) { + SharedTimer timer("Import resolution"); // Make sure we skip adding the standard library imports if the // source file is empty. - if (SF.ASTStage == SourceFile::NameBound || SF.Decls.empty()) { - SF.ASTStage = SourceFile::NameBound; + if (SF.ASTStage == SourceFile::ImportsResolved || SF.Decls.empty()) { + SF.ASTStage = SourceFile::ImportsResolved; return; } @@ -410,7 +392,7 @@ void swift::performNameBinding(SourceFile &SF, unsigned StartElem) { // FIXME: This is inefficient. SF.clearLookupCache(); - NameBinder Binder(SF); + ImportResolver Resolver(SF); SmallVector ImportedModules; @@ -418,21 +400,20 @@ void swift::performNameBinding(SourceFile &SF, unsigned StartElem) { // and map operator decls. for (auto D : llvm::makeArrayRef(SF.Decls).slice(StartElem)) { if (auto *ID = dyn_cast(D)) { - Binder.addImport(ImportedModules, ID); + Resolver.addImport(ImportedModules, ID); } else if (auto *OD = dyn_cast(D)) { - insertOperatorDecl(Binder, SF.PrefixOperators, OD); + insertOperatorDecl(Resolver, SF.PrefixOperators, OD); } else if (auto *OD = dyn_cast(D)) { - insertOperatorDecl(Binder, SF.PostfixOperators, OD); + insertOperatorDecl(Resolver, SF.PostfixOperators, OD); } else if (auto *OD = dyn_cast(D)) { - insertOperatorDecl(Binder, SF.InfixOperators, OD); + insertOperatorDecl(Resolver, SF.InfixOperators, OD); } else if (auto *PGD = dyn_cast(D)) { - insertPrecedenceGroupDecl(Binder, SF, PGD); + insertPrecedenceGroupDecl(Resolver, SF, PGD); } } SF.addImports(ImportedModules); - SF.ASTStage = SourceFile::NameBound; + SF.ASTStage = SourceFile::ImportsResolved; verify(SF); } - diff --git a/lib/Sema/SourceLoader.cpp b/lib/Sema/SourceLoader.cpp index 3026605d6faf5..0e9137dad6c1c 100644 --- a/lib/Sema/SourceLoader.cpp +++ b/lib/Sema/SourceLoader.cpp @@ -136,7 +136,7 @@ ModuleDecl *SourceLoader::loadModule(SourceLoc importLoc, assert(done && "Parser returned early?"); (void)done; - performNameBinding(*importFile); + resolveImportsAndOperators(*importFile); importMod->setHasResolvedImports(); return importMod; } diff --git a/lib/Sema/TypeCheckType.h b/lib/Sema/TypeCheckType.h index e9c5c3162ba4e..9d2b6367f7584 100644 --- a/lib/Sema/TypeCheckType.h +++ b/lib/Sema/TypeCheckType.h @@ -336,7 +336,7 @@ class TypeResolution { /// Resolves a TypeRepr to a type. /// - /// Performs name binding, checking of generic arguments, and so on in order + /// Performs name lookup, checking of generic arguments, and so on in order /// to create a well-formed type. /// /// \param TyR The type representation to check. diff --git a/lib/Sema/TypeChecker.cpp b/lib/Sema/TypeChecker.cpp index 3f4a317936f23..a6fc8881ae165 100644 --- a/lib/Sema/TypeChecker.cpp +++ b/lib/Sema/TypeChecker.cpp @@ -375,10 +375,10 @@ void swift::performTypeChecking(SourceFile &SF, TopLevelContext &TLC, // Make sure we have a type checker. TypeChecker &TC = createTypeChecker(Ctx); - // Make sure that name binding has been completed before doing any type + // Make sure that import resolution has been completed before doing any type // checking. - performNameBinding(SF, StartElem); - + resolveImportsAndOperators(SF, StartElem); + // Could build scope maps here because the AST is stable now. { @@ -431,7 +431,6 @@ void swift::performTypeChecking(SourceFile &SF, TopLevelContext &TLC, // Type check the top-level elements of the source file. for (auto D : llvm::makeArrayRef(SF.Decls).slice(StartElem)) { if (auto *TLCD = dyn_cast(D)) { - // Immediately perform global name-binding etc. TC.typeCheckTopLevelCodeDecl(TLCD); TC.contextualizeTopLevelCode(TLC, TLCD); } else { diff --git a/lib/Sema/TypeChecker.h b/lib/Sema/TypeChecker.h index 1eff916518a8b..9b36584b9b47e 100644 --- a/lib/Sema/TypeChecker.h +++ b/lib/Sema/TypeChecker.h @@ -541,7 +541,7 @@ enum class FunctionBuilderClosurePreCheck : uint8_t { HasReturnStmt, }; -/// The Swift type checker, which takes a parsed AST and performs name binding, +/// The Swift type checker, which takes a parsed AST and performs validation, /// type checking, and semantic analysis to produce a type-annotated AST. class TypeChecker final : public LazyResolver { public: @@ -760,7 +760,7 @@ class TypeChecker final : public LazyResolver { /// Validate the given type. /// - /// Type validation performs name binding, checking of generic arguments, + /// Type validation performs name lookup, checking of generic arguments, /// and so on to determine whether the given type is well-formed and can /// be used as a type. /// diff --git a/test/NameBinding/Dependencies/Inputs/InterestingType.swift b/test/ImportResolution/Dependencies/Inputs/InterestingType.swift similarity index 100% rename from test/NameBinding/Dependencies/Inputs/InterestingType.swift rename to test/ImportResolution/Dependencies/Inputs/InterestingType.swift diff --git a/test/NameBinding/Dependencies/private-function-return-type.swift b/test/ImportResolution/Dependencies/private-function-return-type.swift similarity index 100% rename from test/NameBinding/Dependencies/private-function-return-type.swift rename to test/ImportResolution/Dependencies/private-function-return-type.swift diff --git a/test/NameBinding/Dependencies/private-function.swift b/test/ImportResolution/Dependencies/private-function.swift similarity index 100% rename from test/NameBinding/Dependencies/private-function.swift rename to test/ImportResolution/Dependencies/private-function.swift diff --git a/test/NameBinding/Dependencies/private-protocol-conformer-ext.swift b/test/ImportResolution/Dependencies/private-protocol-conformer-ext.swift similarity index 100% rename from test/NameBinding/Dependencies/private-protocol-conformer-ext.swift rename to test/ImportResolution/Dependencies/private-protocol-conformer-ext.swift diff --git a/test/NameBinding/Dependencies/private-protocol-conformer.swift b/test/ImportResolution/Dependencies/private-protocol-conformer.swift similarity index 100% rename from test/NameBinding/Dependencies/private-protocol-conformer.swift rename to test/ImportResolution/Dependencies/private-protocol-conformer.swift diff --git a/test/NameBinding/Dependencies/private-struct-member.swift b/test/ImportResolution/Dependencies/private-struct-member.swift similarity index 100% rename from test/NameBinding/Dependencies/private-struct-member.swift rename to test/ImportResolution/Dependencies/private-struct-member.swift diff --git a/test/NameBinding/Dependencies/private-subscript.swift b/test/ImportResolution/Dependencies/private-subscript.swift similarity index 100% rename from test/NameBinding/Dependencies/private-subscript.swift rename to test/ImportResolution/Dependencies/private-subscript.swift diff --git a/test/NameBinding/Dependencies/private-typealias.swift b/test/ImportResolution/Dependencies/private-typealias.swift similarity index 100% rename from test/NameBinding/Dependencies/private-typealias.swift rename to test/ImportResolution/Dependencies/private-typealias.swift diff --git a/test/NameBinding/Dependencies/private-var.swift b/test/ImportResolution/Dependencies/private-var.swift similarity index 100% rename from test/NameBinding/Dependencies/private-var.swift rename to test/ImportResolution/Dependencies/private-var.swift diff --git a/test/NameBinding/InheritedConformance.swift b/test/ImportResolution/InheritedConformance.swift similarity index 100% rename from test/NameBinding/InheritedConformance.swift rename to test/ImportResolution/InheritedConformance.swift diff --git a/test/NameBinding/Inputs/DeclsUsedWrongly.swift b/test/ImportResolution/Inputs/DeclsUsedWrongly.swift similarity index 100% rename from test/NameBinding/Inputs/DeclsUsedWrongly.swift rename to test/ImportResolution/Inputs/DeclsUsedWrongly.swift diff --git a/test/NameBinding/Inputs/HasPrivateAccess1.swift b/test/ImportResolution/Inputs/HasPrivateAccess1.swift similarity index 100% rename from test/NameBinding/Inputs/HasPrivateAccess1.swift rename to test/ImportResolution/Inputs/HasPrivateAccess1.swift diff --git a/test/NameBinding/Inputs/HasPrivateAccess2.swift b/test/ImportResolution/Inputs/HasPrivateAccess2.swift similarity index 100% rename from test/NameBinding/Inputs/HasPrivateAccess2.swift rename to test/ImportResolution/Inputs/HasPrivateAccess2.swift diff --git a/test/NameBinding/Inputs/HasResult.swift b/test/ImportResolution/Inputs/HasResult.swift similarity index 100% rename from test/NameBinding/Inputs/HasResult.swift rename to test/ImportResolution/Inputs/HasResult.swift diff --git a/test/NameBinding/Inputs/MemberTypesInClasses.swift b/test/ImportResolution/Inputs/MemberTypesInClasses.swift similarity index 100% rename from test/NameBinding/Inputs/MemberTypesInClasses.swift rename to test/ImportResolution/Inputs/MemberTypesInClasses.swift diff --git a/test/NameBinding/Inputs/NIOFoundationCompat.swift b/test/ImportResolution/Inputs/NIOFoundationCompat.swift similarity index 100% rename from test/NameBinding/Inputs/NIOFoundationCompat.swift rename to test/ImportResolution/Inputs/NIOFoundationCompat.swift diff --git a/test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembers.h b/test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembers.h similarity index 100% rename from test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembers.h rename to test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembers.h diff --git a/test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembers.swift b/test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembers.swift similarity index 100% rename from test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembers.swift rename to test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembers.swift diff --git a/test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembersExt.swift b/test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembersExt.swift similarity index 100% rename from test/NameBinding/Inputs/NamedLazyMembers/NamedLazyMembersExt.swift rename to test/ImportResolution/Inputs/NamedLazyMembers/NamedLazyMembersExt.swift diff --git a/test/NameBinding/Inputs/NamedLazyMembers/module.modulemap b/test/ImportResolution/Inputs/NamedLazyMembers/module.modulemap similarity index 100% rename from test/NameBinding/Inputs/NamedLazyMembers/module.modulemap rename to test/ImportResolution/Inputs/NamedLazyMembers/module.modulemap diff --git a/test/NameBinding/Inputs/TestableVersusIndirect1.swift b/test/ImportResolution/Inputs/TestableVersusIndirect1.swift similarity index 100% rename from test/NameBinding/Inputs/TestableVersusIndirect1.swift rename to test/ImportResolution/Inputs/TestableVersusIndirect1.swift diff --git a/test/NameBinding/Inputs/TestableVersusIndirect2.swift b/test/ImportResolution/Inputs/TestableVersusIndirect2.swift similarity index 100% rename from test/NameBinding/Inputs/TestableVersusIndirect2.swift rename to test/ImportResolution/Inputs/TestableVersusIndirect2.swift diff --git a/test/NameBinding/Inputs/TestableVersusIndirectImporter.swift b/test/ImportResolution/Inputs/TestableVersusIndirectImporter.swift similarity index 100% rename from test/NameBinding/Inputs/TestableVersusIndirectImporter.swift rename to test/ImportResolution/Inputs/TestableVersusIndirectImporter.swift diff --git a/test/NameBinding/Inputs/abcde.swift b/test/ImportResolution/Inputs/abcde.swift similarity index 100% rename from test/NameBinding/Inputs/abcde.swift rename to test/ImportResolution/Inputs/abcde.swift diff --git a/test/NameBinding/Inputs/accessibility_other.swift b/test/ImportResolution/Inputs/accessibility_other.swift similarity index 100% rename from test/NameBinding/Inputs/accessibility_other.swift rename to test/ImportResolution/Inputs/accessibility_other.swift diff --git a/test/NameBinding/Inputs/aeiou.swift b/test/ImportResolution/Inputs/aeiou.swift similarity index 100% rename from test/NameBinding/Inputs/aeiou.swift rename to test/ImportResolution/Inputs/aeiou.swift diff --git a/test/NameBinding/Inputs/ambiguous.swift b/test/ImportResolution/Inputs/ambiguous.swift similarity index 100% rename from test/NameBinding/Inputs/ambiguous.swift rename to test/ImportResolution/Inputs/ambiguous.swift diff --git a/test/NameBinding/Inputs/ambiguous_left.swift b/test/ImportResolution/Inputs/ambiguous_left.swift similarity index 100% rename from test/NameBinding/Inputs/ambiguous_left.swift rename to test/ImportResolution/Inputs/ambiguous_left.swift diff --git a/test/NameBinding/Inputs/ambiguous_right.swift b/test/ImportResolution/Inputs/ambiguous_right.swift similarity index 100% rename from test/NameBinding/Inputs/ambiguous_right.swift rename to test/ImportResolution/Inputs/ambiguous_right.swift diff --git a/test/NameBinding/Inputs/asdf.swift b/test/ImportResolution/Inputs/asdf.swift similarity index 100% rename from test/NameBinding/Inputs/asdf.swift rename to test/ImportResolution/Inputs/asdf.swift diff --git a/test/NameBinding/Inputs/has_accessibility.swift b/test/ImportResolution/Inputs/has_accessibility.swift similarity index 100% rename from test/NameBinding/Inputs/has_accessibility.swift rename to test/ImportResolution/Inputs/has_accessibility.swift diff --git a/test/NameBinding/Inputs/imported_module.swift b/test/ImportResolution/Inputs/imported_module.swift similarity index 100% rename from test/NameBinding/Inputs/imported_module.swift rename to test/ImportResolution/Inputs/imported_module.swift diff --git a/test/NameBinding/Inputs/lazy_function_body_expansion_helper.swift b/test/ImportResolution/Inputs/lazy_function_body_expansion_helper.swift similarity index 100% rename from test/NameBinding/Inputs/lazy_function_body_expansion_helper.swift rename to test/ImportResolution/Inputs/lazy_function_body_expansion_helper.swift diff --git a/test/NameBinding/Inputs/letters.swift b/test/ImportResolution/Inputs/letters.swift similarity index 100% rename from test/NameBinding/Inputs/letters.swift rename to test/ImportResolution/Inputs/letters.swift diff --git a/test/NameBinding/Inputs/multi-file-2.swift b/test/ImportResolution/Inputs/multi-file-2.swift similarity index 100% rename from test/NameBinding/Inputs/multi-file-2.swift rename to test/ImportResolution/Inputs/multi-file-2.swift diff --git a/test/NameBinding/Inputs/multi-file-3.swift b/test/ImportResolution/Inputs/multi-file-3.swift similarity index 100% rename from test/NameBinding/Inputs/multi-file-3.swift rename to test/ImportResolution/Inputs/multi-file-3.swift diff --git a/test/NameBinding/Inputs/multi-file-with-main/main.swift b/test/ImportResolution/Inputs/multi-file-with-main/main.swift similarity index 100% rename from test/NameBinding/Inputs/multi-file-with-main/main.swift rename to test/ImportResolution/Inputs/multi-file-with-main/main.swift diff --git a/test/NameBinding/Inputs/objc_multi_file_2.swift b/test/ImportResolution/Inputs/objc_multi_file_2.swift similarity index 100% rename from test/NameBinding/Inputs/objc_multi_file_2.swift rename to test/ImportResolution/Inputs/objc_multi_file_2.swift diff --git a/test/NameBinding/Inputs/overload_boolFunctions.swift b/test/ImportResolution/Inputs/overload_boolFunctions.swift similarity index 100% rename from test/NameBinding/Inputs/overload_boolFunctions.swift rename to test/ImportResolution/Inputs/overload_boolFunctions.swift diff --git a/test/NameBinding/Inputs/overload_intFunctions.swift b/test/ImportResolution/Inputs/overload_intFunctions.swift similarity index 100% rename from test/NameBinding/Inputs/overload_intFunctions.swift rename to test/ImportResolution/Inputs/overload_intFunctions.swift diff --git a/test/NameBinding/Inputs/overload_vars.swift b/test/ImportResolution/Inputs/overload_vars.swift similarity index 100% rename from test/NameBinding/Inputs/overload_vars.swift rename to test/ImportResolution/Inputs/overload_vars.swift diff --git a/test/NameBinding/Inputs/property_wrappers_A.swift b/test/ImportResolution/Inputs/property_wrappers_A.swift similarity index 100% rename from test/NameBinding/Inputs/property_wrappers_A.swift rename to test/ImportResolution/Inputs/property_wrappers_A.swift diff --git a/test/NameBinding/Inputs/property_wrappers_B.swift b/test/ImportResolution/Inputs/property_wrappers_B.swift similarity index 100% rename from test/NameBinding/Inputs/property_wrappers_B.swift rename to test/ImportResolution/Inputs/property_wrappers_B.swift diff --git a/test/NameBinding/Inputs/protocol-inheritance.swift b/test/ImportResolution/Inputs/protocol-inheritance.swift similarity index 100% rename from test/NameBinding/Inputs/protocol-inheritance.swift rename to test/ImportResolution/Inputs/protocol-inheritance.swift diff --git a/test/NameBinding/Inputs/reference-dependencies-helper.swift b/test/ImportResolution/Inputs/reference-dependencies-helper.swift similarity index 100% rename from test/NameBinding/Inputs/reference-dependencies-helper.swift rename to test/ImportResolution/Inputs/reference-dependencies-helper.swift diff --git a/test/NameBinding/Inputs/reference-dependencies-members-helper.swift b/test/ImportResolution/Inputs/reference-dependencies-members-helper.swift similarity index 100% rename from test/NameBinding/Inputs/reference-dependencies-members-helper.swift rename to test/ImportResolution/Inputs/reference-dependencies-members-helper.swift diff --git a/test/NameBinding/Inputs/sdf.swift b/test/ImportResolution/Inputs/sdf.swift similarity index 100% rename from test/NameBinding/Inputs/sdf.swift rename to test/ImportResolution/Inputs/sdf.swift diff --git a/test/NameBinding/Inputs/tilde_tilde_high_precedence.swift b/test/ImportResolution/Inputs/tilde_tilde_high_precedence.swift similarity index 100% rename from test/NameBinding/Inputs/tilde_tilde_high_precedence.swift rename to test/ImportResolution/Inputs/tilde_tilde_high_precedence.swift diff --git a/test/NameBinding/Inputs/tilde_tilde_low_precedence.swift b/test/ImportResolution/Inputs/tilde_tilde_low_precedence.swift similarity index 100% rename from test/NameBinding/Inputs/tilde_tilde_low_precedence.swift rename to test/ImportResolution/Inputs/tilde_tilde_low_precedence.swift diff --git a/test/NameBinding/accessibility.swift b/test/ImportResolution/accessibility.swift similarity index 100% rename from test/NameBinding/accessibility.swift rename to test/ImportResolution/accessibility.swift diff --git a/test/NameBinding/debug-client-discriminator.swift b/test/ImportResolution/debug-client-discriminator.swift similarity index 100% rename from test/NameBinding/debug-client-discriminator.swift rename to test/ImportResolution/debug-client-discriminator.swift diff --git a/test/NameBinding/disabled_opaque_decl.swift b/test/ImportResolution/disabled_opaque_decl.swift similarity index 100% rename from test/NameBinding/disabled_opaque_decl.swift rename to test/ImportResolution/disabled_opaque_decl.swift diff --git a/test/NameBinding/import-command-line.swift b/test/ImportResolution/import-command-line.swift similarity index 100% rename from test/NameBinding/import-command-line.swift rename to test/ImportResolution/import-command-line.swift diff --git a/test/NameBinding/import-implementation-only.swift b/test/ImportResolution/import-implementation-only.swift similarity index 100% rename from test/NameBinding/import-implementation-only.swift rename to test/ImportResolution/import-implementation-only.swift diff --git a/test/NameBinding/import-multiple-command-line.swift b/test/ImportResolution/import-multiple-command-line.swift similarity index 100% rename from test/NameBinding/import-multiple-command-line.swift rename to test/ImportResolution/import-multiple-command-line.swift diff --git a/test/NameBinding/import-resolution-2.swift b/test/ImportResolution/import-resolution-2.swift similarity index 100% rename from test/NameBinding/import-resolution-2.swift rename to test/ImportResolution/import-resolution-2.swift diff --git a/test/NameBinding/import-resolution-3.swift b/test/ImportResolution/import-resolution-3.swift similarity index 100% rename from test/NameBinding/import-resolution-3.swift rename to test/ImportResolution/import-resolution-3.swift diff --git a/test/NameBinding/import-resolution-overload.swift b/test/ImportResolution/import-resolution-overload.swift similarity index 100% rename from test/NameBinding/import-resolution-overload.swift rename to test/ImportResolution/import-resolution-overload.swift diff --git a/test/NameBinding/import-resolution-overload_swift4.swift b/test/ImportResolution/import-resolution-overload_swift4.swift similarity index 100% rename from test/NameBinding/import-resolution-overload_swift4.swift rename to test/ImportResolution/import-resolution-overload_swift4.swift diff --git a/test/NameBinding/import-resolution-overload_swift5.swift b/test/ImportResolution/import-resolution-overload_swift5.swift similarity index 100% rename from test/NameBinding/import-resolution-overload_swift5.swift rename to test/ImportResolution/import-resolution-overload_swift5.swift diff --git a/test/NameBinding/import-resolution.swift b/test/ImportResolution/import-resolution.swift similarity index 100% rename from test/NameBinding/import-resolution.swift rename to test/ImportResolution/import-resolution.swift diff --git a/test/NameBinding/import-specific-decl.swift b/test/ImportResolution/import-specific-decl.swift similarity index 100% rename from test/NameBinding/import-specific-decl.swift rename to test/ImportResolution/import-specific-decl.swift diff --git a/test/NameBinding/import-specific-fixits.swift b/test/ImportResolution/import-specific-fixits.swift similarity index 100% rename from test/NameBinding/import-specific-fixits.swift rename to test/ImportResolution/import-specific-fixits.swift diff --git a/test/NameBinding/lazy_function_body_expansion.swift b/test/ImportResolution/lazy_function_body_expansion.swift similarity index 100% rename from test/NameBinding/lazy_function_body_expansion.swift rename to test/ImportResolution/lazy_function_body_expansion.swift diff --git a/test/NameBinding/library.swift b/test/ImportResolution/library.swift similarity index 100% rename from test/NameBinding/library.swift rename to test/ImportResolution/library.swift diff --git a/test/NameBinding/member_type_shadowing.swift b/test/ImportResolution/member_type_shadowing.swift similarity index 100% rename from test/NameBinding/member_type_shadowing.swift rename to test/ImportResolution/member_type_shadowing.swift diff --git a/test/NameBinding/multi-file-with-main.swift b/test/ImportResolution/multi-file-with-main.swift similarity index 100% rename from test/NameBinding/multi-file-with-main.swift rename to test/ImportResolution/multi-file-with-main.swift diff --git a/test/NameBinding/multi-file.swift b/test/ImportResolution/multi-file.swift similarity index 100% rename from test/NameBinding/multi-file.swift rename to test/ImportResolution/multi-file.swift diff --git a/test/NameBinding/name-binding.swift b/test/ImportResolution/name-binding.swift similarity index 100% rename from test/NameBinding/name-binding.swift rename to test/ImportResolution/name-binding.swift diff --git a/test/NameBinding/name_lookup.swift b/test/ImportResolution/name_lookup.swift similarity index 100% rename from test/NameBinding/name_lookup.swift rename to test/ImportResolution/name_lookup.swift diff --git a/test/NameBinding/name_lookup_min_max_conditional_conformance.swift b/test/ImportResolution/name_lookup_min_max_conditional_conformance.swift similarity index 100% rename from test/NameBinding/name_lookup_min_max_conditional_conformance.swift rename to test/ImportResolution/name_lookup_min_max_conditional_conformance.swift diff --git a/test/NameBinding/named_lazy_member_loading_anyobject.swift b/test/ImportResolution/named_lazy_member_loading_anyobject.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_anyobject.swift rename to test/ImportResolution/named_lazy_member_loading_anyobject.swift diff --git a/test/NameBinding/named_lazy_member_loading_objc_category.swift b/test/ImportResolution/named_lazy_member_loading_objc_category.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_objc_category.swift rename to test/ImportResolution/named_lazy_member_loading_objc_category.swift diff --git a/test/NameBinding/named_lazy_member_loading_objc_interface.swift b/test/ImportResolution/named_lazy_member_loading_objc_interface.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_objc_interface.swift rename to test/ImportResolution/named_lazy_member_loading_objc_interface.swift diff --git a/test/NameBinding/named_lazy_member_loading_objc_protocol.swift b/test/ImportResolution/named_lazy_member_loading_objc_protocol.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_objc_protocol.swift rename to test/ImportResolution/named_lazy_member_loading_objc_protocol.swift diff --git a/test/NameBinding/named_lazy_member_loading_protocol_mirroring.swift b/test/ImportResolution/named_lazy_member_loading_protocol_mirroring.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_protocol_mirroring.swift rename to test/ImportResolution/named_lazy_member_loading_protocol_mirroring.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_class.swift b/test/ImportResolution/named_lazy_member_loading_swift_class.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_class.swift rename to test/ImportResolution/named_lazy_member_loading_swift_class.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_class_type.swift b/test/ImportResolution/named_lazy_member_loading_swift_class_type.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_class_type.swift rename to test/ImportResolution/named_lazy_member_loading_swift_class_type.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_derived_class.swift b/test/ImportResolution/named_lazy_member_loading_swift_derived_class.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_derived_class.swift rename to test/ImportResolution/named_lazy_member_loading_swift_derived_class.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_derived_class_type.swift b/test/ImportResolution/named_lazy_member_loading_swift_derived_class_type.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_derived_class_type.swift rename to test/ImportResolution/named_lazy_member_loading_swift_derived_class_type.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_enum.swift b/test/ImportResolution/named_lazy_member_loading_swift_enum.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_enum.swift rename to test/ImportResolution/named_lazy_member_loading_swift_enum.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_proto.swift b/test/ImportResolution/named_lazy_member_loading_swift_proto.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_proto.swift rename to test/ImportResolution/named_lazy_member_loading_swift_proto.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_struct.swift b/test/ImportResolution/named_lazy_member_loading_swift_struct.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_struct.swift rename to test/ImportResolution/named_lazy_member_loading_swift_struct.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_struct_ext.swift b/test/ImportResolution/named_lazy_member_loading_swift_struct_ext.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_struct_ext.swift rename to test/ImportResolution/named_lazy_member_loading_swift_struct_ext.swift diff --git a/test/NameBinding/named_lazy_member_loading_swift_struct_ext_mem.swift b/test/ImportResolution/named_lazy_member_loading_swift_struct_ext_mem.swift similarity index 100% rename from test/NameBinding/named_lazy_member_loading_swift_struct_ext_mem.swift rename to test/ImportResolution/named_lazy_member_loading_swift_struct_ext_mem.swift diff --git a/test/NameBinding/nio_shadowing.swift b/test/ImportResolution/nio_shadowing.swift similarity index 100% rename from test/NameBinding/nio_shadowing.swift rename to test/ImportResolution/nio_shadowing.swift diff --git a/test/NameBinding/objc_multi_file.swift b/test/ImportResolution/objc_multi_file.swift similarity index 100% rename from test/NameBinding/objc_multi_file.swift rename to test/ImportResolution/objc_multi_file.swift diff --git a/test/NameBinding/property_wrappers_ambig.swift b/test/ImportResolution/property_wrappers_ambig.swift similarity index 100% rename from test/NameBinding/property_wrappers_ambig.swift rename to test/ImportResolution/property_wrappers_ambig.swift diff --git a/test/NameBinding/protocol-inheritance.swift b/test/ImportResolution/protocol-inheritance.swift similarity index 100% rename from test/NameBinding/protocol-inheritance.swift rename to test/ImportResolution/protocol-inheritance.swift diff --git a/test/NameBinding/reference-dependencies-consistency.swift b/test/ImportResolution/reference-dependencies-consistency.swift similarity index 100% rename from test/NameBinding/reference-dependencies-consistency.swift rename to test/ImportResolution/reference-dependencies-consistency.swift diff --git a/test/NameBinding/reference-dependencies-dynamic-lookup.swift b/test/ImportResolution/reference-dependencies-dynamic-lookup.swift similarity index 100% rename from test/NameBinding/reference-dependencies-dynamic-lookup.swift rename to test/ImportResolution/reference-dependencies-dynamic-lookup.swift diff --git a/test/NameBinding/reference-dependencies-errors.swift b/test/ImportResolution/reference-dependencies-errors.swift similarity index 100% rename from test/NameBinding/reference-dependencies-errors.swift rename to test/ImportResolution/reference-dependencies-errors.swift diff --git a/test/NameBinding/reference-dependencies-members.swift b/test/ImportResolution/reference-dependencies-members.swift similarity index 100% rename from test/NameBinding/reference-dependencies-members.swift rename to test/ImportResolution/reference-dependencies-members.swift diff --git a/test/NameBinding/reference-dependencies.swift b/test/ImportResolution/reference-dependencies.swift similarity index 100% rename from test/NameBinding/reference-dependencies.swift rename to test/ImportResolution/reference-dependencies.swift diff --git a/test/NameBinding/scope_map-astscopelookup.swift b/test/ImportResolution/scope_map-astscopelookup.swift similarity index 97% rename from test/NameBinding/scope_map-astscopelookup.swift rename to test/ImportResolution/scope_map-astscopelookup.swift index 7b0cae18c80a1..95e7bffd1ba46 100644 --- a/test/NameBinding/scope_map-astscopelookup.swift +++ b/test/ImportResolution/scope_map-astscopelookup.swift @@ -199,7 +199,7 @@ class LazyProperties { // CHECK-EXPANDED: ***Complete scope map*** -// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 5{{[0-9]*}}:1] 'SOURCE_DIR{{[/]}}test{{[/]}}NameBinding{{[/]}}scope_map-astscopelookup.swift' +// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 5{{[0-9]*}}:1] 'SOURCE_DIR{{[/]}}test{{[/]}}ImportResolution{{[/]}}scope_map-astscopelookup.swift' // CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [5:1 - 7:1] 'S0' // CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [5:11 - 7:1] 'S0' // CHECK-EXPANDED-NEXT: `-NominalTypeDeclScope {{.*}}, [6:3 - 6:19] 'InnerC0' @@ -342,7 +342,7 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: `-EnumElementScope {{.*}}, [112:8 - 112:8] // CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [115:1 - 131:1] 'StructContainsAbstractStorageDecls' // CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [115:43 - 131:1] 'StructContainsAbstractStorageDecls' -// CHECK-EXPANDED-NEXT: |-SubscriptDeclScope {{.*}}, [116:3 - 122:3] main.(file).StructContainsAbstractStorageDecls.subscript(_:_:)@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:116:3 +// CHECK-EXPANDED-NEXT: |-SubscriptDeclScope {{.*}}, [116:3 - 122:3] main.(file).StructContainsAbstractStorageDecls.subscript(_:_:)@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:116:3 // CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [116:13 - 122:3] // CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [117:5 - 118:5] '_' // CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [117:9 - 118:5] @@ -351,7 +351,7 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [119:9 - 121:5] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [119:9 - 121:5] // CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [124:21 - 130:3] entry 0 'computed' -// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [124:21 - 130:3] main.(file).StructContainsAbstractStorageDecls.computed@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:124:7 +// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [124:21 - 130:3] main.(file).StructContainsAbstractStorageDecls.computed@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:124:7 // CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [125:5 - 127:5] '_' // CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [125:9 - 127:5] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [125:9 - 127:5] @@ -362,13 +362,13 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [133:35 - 141:1] 'ClassWithComputedProperties' // CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [134:7 - 136:3] entry 0 'willSetProperty' // CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [134:30 - 134:30] entry 0 'willSetProperty' -// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [134:32 - 136:3] main.(file).ClassWithComputedProperties.willSetProperty@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:134:7 +// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [134:32 - 136:3] main.(file).ClassWithComputedProperties.willSetProperty@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:134:7 // CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [135:5 - 135:15] '_' // CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [135:13 - 135:15] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [135:13 - 135:15] // CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [138:7 - 140:3] entry 0 'didSetProperty' // CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [138:29 - 138:29] entry 0 'didSetProperty' -// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [138:31 - 140:3] main.(file).ClassWithComputedProperties.didSetProperty@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:138:7 +// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [138:31 - 140:3] main.(file).ClassWithComputedProperties.didSetProperty@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:138:7 // CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [139:5 - 139:14] '_' // CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [139:12 - 139:14] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [139:12 - 139:14] @@ -377,7 +377,7 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [143:41 - 156:1] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [143:41 - 156:1] // CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [144:21 - 150:3] entry 0 'computed' -// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [144:21 - 150:3] main.(file).funcWithComputedProperties(i:).computed@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:144:7 +// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [144:21 - 150:3] main.(file).funcWithComputedProperties(i:).computed@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:144:7 // CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [145:5 - 146:5] '_' // CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [145:9 - 146:5] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [145:9 - 146:5] @@ -387,7 +387,7 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [150:6 - 150:36] entry 1 'stored1' 'stored2' // CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [150:31 - 150:36] entry 1 'stored1' 'stored2' // CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [151:25 - 153:3] entry 2 'alsoComputed' -// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [151:25 - 153:3] main.(file).funcWithComputedProperties(i:).alsoComputed@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:151:7 +// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [151:25 - 153:3] main.(file).funcWithComputedProperties(i:).alsoComputed@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:151:7 // CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [151:25 - 153:3] '_' // CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [151:25 - 153:3] // CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [151:25 - 153:3] @@ -444,7 +444,7 @@ class LazyProperties { // CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [183:1 - 185:1] 'ProtoWithSubscript' // CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [183:29 - 185:1] param 0 'Self : ProtoWithSubscript' // CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [183:29 - 185:1] 'ProtoWithSubscript' -// CHECK-EXPANDED-NEXT: `-SubscriptDeclScope {{.*}}, [184:3 - 184:43] main.(file).ProtoWithSubscript.subscript(_:)@SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift:184:3 +// CHECK-EXPANDED-NEXT: `-SubscriptDeclScope {{.*}}, [184:3 - 184:43] main.(file).ProtoWithSubscript.subscript(_:)@SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift:184:3 // CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [184:12 - 184:43] // CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [184:35 - 184:35] '_' // CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [184:39 - 184:39] '_' @@ -475,25 +475,25 @@ class LazyProperties { // CHECK-SEARCHES-NEXT: ***Scope at 6:18*** // CHECK-SEARCHES-NEXT: NominalTypeBodyScope {{.*}}, [6:17 - 6:19] 'InnerC0' // CHECK-SEARCHES-NEXT: {{.*}} Module name=main -// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift" +// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift" // CHECK-SEARCHES-NEXT: {{.*}} StructDecl name=S0 // CHECK-SEARCHES-NEXT: {{.*}} ClassDecl name=InnerC0 // CHECK-SEARCHES-NEXT: ***Scope at 167:32*** // CHECK-SEARCHES-NEXT: DefaultArgumentInitializerScope {{.*}}, [167:32 - 167:32] // CHECK-SEARCHES-NEXT: {{.*}} Module name=main -// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift" +// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift" // CHECK-SEARCHES-NEXT: {{.*}} AbstractFunctionDecl name=defaultArguments(i:j:) : (Int, Int) -> () // CHECK-SEARCHES-NEXT: {{.*}} Initializer DefaultArgument index=0 // CHECK-SEARCHES-NEXT: ***Scope at 180:18*** // CHECK-SEARCHES-NEXT: PatternEntryInitializerScope {{.*}}, [180:16 - 180:25] entry 1 'c' 'd' // CHECK-SEARCHES-NEXT: {{.*}} Module name=main -// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift" +// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift" // CHECK-SEARCHES-NEXT: {{.*}} StructDecl name=PatternInitializers // CHECK-SEARCHES-NEXT: {{.*}} Initializer PatternBinding {{.*}} #1 // CHECK-SEARCHES-NEXT: ***Scope at 194:26*** // CHECK-SEARCHES-NEXT: PatternEntryInitializerScope {{.*}}, [194:24 - 194:29] entry 0 'prop' // CHECK-SEARCHES-NEXT: {{.*}} Module name=main -// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map-astscopelookup.swift" +// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/ImportResolution/scope_map-astscopelookup.swift" // CHECK-SEARCHES-NEXT: {{.*}} ClassDecl name=LazyProperties // CHECK-SEARCHES-NEXT: {{.*}} Initializer PatternBinding {{.*}} #0 // CHECK-SEARCHES-NEXT: Local bindings: self diff --git a/test/NameBinding/scope_map_lookup.swift b/test/ImportResolution/scope_map_lookup.swift similarity index 100% rename from test/NameBinding/scope_map_lookup.swift rename to test/ImportResolution/scope_map_lookup.swift diff --git a/test/NameBinding/scope_map_lookup_extension_extension.swift b/test/ImportResolution/scope_map_lookup_extension_extension.swift similarity index 100% rename from test/NameBinding/scope_map_lookup_extension_extension.swift rename to test/ImportResolution/scope_map_lookup_extension_extension.swift diff --git a/test/NameBinding/scope_map_top_level.swift b/test/ImportResolution/scope_map_top_level.swift similarity index 97% rename from test/NameBinding/scope_map_top_level.swift rename to test/ImportResolution/scope_map_top_level.swift index ed59389d34b68..b7d9400e5be73 100644 --- a/test/NameBinding/scope_map_top_level.swift +++ b/test/ImportResolution/scope_map_top_level.swift @@ -26,7 +26,7 @@ var i: Int = b.my_identity() // CHECK-EXPANDED: ***Complete scope map*** -// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 6{{.*}}:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map_top_level.swift' +// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 6{{.*}}:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}ImportResolution{{[/\\]}}scope_map_top_level.swift' // CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [4:1 - 4:13] // CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [4:11 - 4:13] // CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [6:1 - 21:28] diff --git a/test/NameBinding/stdlib-case-sensitive.swift b/test/ImportResolution/stdlib-case-sensitive.swift similarity index 100% rename from test/NameBinding/stdlib-case-sensitive.swift rename to test/ImportResolution/stdlib-case-sensitive.swift diff --git a/test/NameBinding/stdlib.swift b/test/ImportResolution/stdlib.swift similarity index 100% rename from test/NameBinding/stdlib.swift rename to test/ImportResolution/stdlib.swift diff --git a/test/NameBinding/stdlib_shadowing.swift b/test/ImportResolution/stdlib_shadowing.swift similarity index 100% rename from test/NameBinding/stdlib_shadowing.swift rename to test/ImportResolution/stdlib_shadowing.swift diff --git a/test/NameBinding/subscript-generic-conjuction-astscope.swift b/test/ImportResolution/subscript-generic-conjuction-astscope.swift similarity index 100% rename from test/NameBinding/subscript-generic-conjuction-astscope.swift rename to test/ImportResolution/subscript-generic-conjuction-astscope.swift diff --git a/test/NameBinding/testable-vs-indirect-import.swift b/test/ImportResolution/testable-vs-indirect-import.swift similarity index 100% rename from test/NameBinding/testable-vs-indirect-import.swift rename to test/ImportResolution/testable-vs-indirect-import.swift diff --git a/test/NameBinding/warn-if-astscope.swift b/test/ImportResolution/warn-if-astscope.swift similarity index 100% rename from test/NameBinding/warn-if-astscope.swift rename to test/ImportResolution/warn-if-astscope.swift diff --git a/validation-test/NameBinding/inconsistent-implementation-only-errors.swift b/validation-test/ImportResolution/inconsistent-implementation-only-errors.swift similarity index 100% rename from validation-test/NameBinding/inconsistent-implementation-only-errors.swift rename to validation-test/ImportResolution/inconsistent-implementation-only-errors.swift