Merge pull request #26535 from davidungar/A-7-9-astscope-no-nesting-off

[NameLookup ASTScope] Latest experimental ASTScope code, off by default.
This commit is contained in:
David Ungar
2019-08-07 19:02:09 -07:00
committed by GitHub
20 changed files with 2127 additions and 1357 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -656,7 +656,7 @@ public:
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
"only for use within the debugger");
void print(llvm::raw_ostream &) const;
void dumpOneScopeMapLocation(std::pair<unsigned, unsigned>) const;
void dumpOneScopeMapLocation(std::pair<unsigned, unsigned>);
// Make vanilla new illegal for ASTScopes.
void *operator new(size_t bytes) = delete;

View File

@@ -53,8 +53,7 @@ Optional<bool> ASTScope::computeIsCascadingUse(
void ASTScope::dump() const { impl->dump(); }
void ASTScope::print(llvm::raw_ostream &out) const { impl->print(out); }
void ASTScope::dumpOneScopeMapLocation(
std::pair<unsigned, unsigned> lineCol) const {
void ASTScope::dumpOneScopeMapLocation(std::pair<unsigned, unsigned> lineCol) {
impl->dumpOneScopeMapLocation(lineCol);
}
@@ -81,20 +80,9 @@ AbstractClosureScope::getClosureIfClosureScope() const {
return closureExpr;
}
Decl *ASTScopeImpl::getEnclosingAbstractFunctionOrSubscriptDecl() const {
return getParent().get()->getEnclosingAbstractFunctionOrSubscriptDecl();
}
Decl *
AbstractFunctionDeclScope::getEnclosingAbstractFunctionOrSubscriptDecl() const {
return decl;
}
Decl *SubscriptDeclScope::getEnclosingAbstractFunctionOrSubscriptDecl() const {
return decl;
}
// Conservative, because using precise info would be circular
SourceRange AttachedPropertyWrapperScope::getCustomAttributesSourceRange(
const VarDecl *const vd) {
SourceRange
AttachedPropertyWrapperScope::getSourceRangeFor(const VarDecl *const vd) {
SourceRange sr;
for (auto *attr : vd->getAttrs().getAttributes<CustomAttr>()) {
if (sr.isInvalid())
@@ -142,7 +130,7 @@ LabeledConditionalStmt *GuardStmtScope::getLabeledConditionalStmt() const {
#pragma mark getASTContext
ASTContext &ASTScopeImpl::getASTContext() const {
if (auto d = getDecl())
if (auto d = getDeclIfAny())
return d.get()->getASTContext();
if (auto dc = getDeclContext())
return dc.get()->getASTContext();
@@ -199,7 +187,7 @@ NullablePtr<DeclContext> AbstractFunctionDeclScope::getDeclContext() const {
return decl;
}
NullablePtr<DeclContext> AbstractFunctionParamsScope::getDeclContext() const {
NullablePtr<DeclContext> ParameterListScope::getDeclContext() const {
return matchingContext;
}
@@ -215,14 +203,13 @@ std::string GenericTypeOrExtensionScope::getClassName() const {
DEFINE_GET_CLASS_NAME(ASTSourceFileScope)
DEFINE_GET_CLASS_NAME(GenericParamScope)
DEFINE_GET_CLASS_NAME(AbstractFunctionDeclScope)
DEFINE_GET_CLASS_NAME(AbstractFunctionParamsScope)
DEFINE_GET_CLASS_NAME(ParameterListScope)
DEFINE_GET_CLASS_NAME(MethodBodyScope)
DEFINE_GET_CLASS_NAME(PureFunctionBodyScope)
DEFINE_GET_CLASS_NAME(DefaultArgumentInitializerScope)
DEFINE_GET_CLASS_NAME(AttachedPropertyWrapperScope)
DEFINE_GET_CLASS_NAME(PatternEntryDeclScope)
DEFINE_GET_CLASS_NAME(PatternEntryInitializerScope)
DEFINE_GET_CLASS_NAME(PatternEntryUseScope)
DEFINE_GET_CLASS_NAME(ConditionalClauseScope)
DEFINE_GET_CLASS_NAME(ConditionalClausePatternUseScope)
DEFINE_GET_CLASS_NAME(CaptureListScope)
@@ -233,10 +220,11 @@ DEFINE_GET_CLASS_NAME(TopLevelCodeScope)
DEFINE_GET_CLASS_NAME(SpecializeAttributeScope)
DEFINE_GET_CLASS_NAME(SubscriptDeclScope)
DEFINE_GET_CLASS_NAME(VarDeclScope)
DEFINE_GET_CLASS_NAME(EnumElementScope)
DEFINE_GET_CLASS_NAME(IfStmtScope)
DEFINE_GET_CLASS_NAME(WhileStmtScope)
DEFINE_GET_CLASS_NAME(GuardStmtScope)
DEFINE_GET_CLASS_NAME(GuardStmtUseScope)
DEFINE_GET_CLASS_NAME(LookupParentDiversionScope)
DEFINE_GET_CLASS_NAME(RepeatWhileScope)
DEFINE_GET_CLASS_NAME(DoCatchStmtScope)
DEFINE_GET_CLASS_NAME(SwitchStmtScope)
@@ -265,6 +253,12 @@ ExtensionScope::getCorrespondingNominalTypeDecl() const {
return decl->getExtendedNominal();
}
void ASTScopeImpl::preOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
fn(this);
for (auto *child : getChildren())
child->preOrderDo(fn);
}
void ASTScopeImpl::postOrderDo(function_ref<void(ASTScopeImpl *)> fn) {
for (auto *child : getChildren())
child->postOrderDo(fn);

File diff suppressed because it is too large Load Diff

View File

@@ -62,7 +62,7 @@ const ASTScopeImpl *ASTScopeImpl::findStartingScopeForLookup(
if (name.isOperator())
return fileScope; // operators always at file scope
const auto innermost = fileScope->findInnermostEnclosingScope(loc);
const auto innermost = fileScope->findInnermostEnclosingScope(loc, nullptr);
// The legacy lookup code gets passed both a SourceLoc and a starting context.
// However, our ultimate intent is for clients to not have to pass in a
@@ -93,6 +93,8 @@ const ASTScopeImpl *ASTScopeImpl::findStartingScopeForLookup(
// llvm::errs() << "in: \n";
// fileScope->dump();
llvm::errs() << "\n\n";
assert(fileScope->crossCheckWithAST());
}
assert(startingScope && "ASTScopeImpl: could not find startingScope");
@@ -100,17 +102,30 @@ const ASTScopeImpl *ASTScopeImpl::findStartingScopeForLookup(
}
const ASTScopeImpl *
ASTScopeImpl::findInnermostEnclosingScope(SourceLoc loc) const {
SourceManager &sourceMgr = getSourceManager();
const auto *s = this;
for (NullablePtr<const ASTScopeImpl> c;
(c = s->findChildContaining(loc, sourceMgr)); s = c.get()) {
}
return s;
ASTScopeImpl::findInnermostEnclosingScope(SourceLoc loc,
NullablePtr<raw_ostream> os) {
return findInnermostEnclosingScopeImpl(loc, os, getSourceManager(),
getScopeCreator());
}
NullablePtr<const ASTScopeImpl>
const ASTScopeImpl *ASTScopeImpl::findInnermostEnclosingScopeImpl(
SourceLoc loc, NullablePtr<raw_ostream> os, SourceManager &sourceMgr,
ScopeCreator &scopeCreator) {
reexpandIfObsolete(scopeCreator);
auto child = findChildContaining(loc, sourceMgr);
if (!child)
return this;
return child.get()->findInnermostEnclosingScopeImpl(loc, os, sourceMgr,
scopeCreator);
}
bool ASTScopeImpl::checkChildlessSourceRange() const {
const auto r = getChildlessSourceRange();
assert(!getSourceManager().isBeforeInBuffer(r.End, r.Start));
return true;
}
NullablePtr<ASTScopeImpl>
ASTScopeImpl::findChildContaining(SourceLoc loc,
SourceManager &sourceMgr) const {
// Use binary search to find the child that contains this location.
@@ -118,9 +133,11 @@ ASTScopeImpl::findChildContaining(SourceLoc loc,
SourceManager &sourceMgr;
bool operator()(const ASTScopeImpl *scope, SourceLoc loc) {
assert(scope->checkChildlessSourceRange());
return sourceMgr.isBeforeInBuffer(scope->getSourceRange().End, loc);
}
bool operator()(SourceLoc loc, const ASTScopeImpl *scope) {
assert(scope->checkChildlessSourceRange());
return sourceMgr.isBeforeInBuffer(loc, scope->getSourceRange().End);
}
};
@@ -322,8 +339,8 @@ bool GenericParamScope::lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
return consumer.consume({param}, DeclVisibilityKind::GenericParameter);
}
bool PatternEntryUseScope::lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
DeclConsumer consumer) const {
bool PatternEntryDeclScope::lookupLocalsOrMembers(
ArrayRef<const ASTScopeImpl *>, DeclConsumer consumer) const {
if (vis != DeclVisibilityKind::LocalVariable)
return false; // look in self type will find this later
return lookupLocalBindingsInPattern(getPattern(), vis, consumer);
@@ -407,9 +424,8 @@ bool BraceStmtScope::lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
SmallVector<ValueDecl *, 32> localBindings;
for (auto braceElement : stmt->getElements()) {
if (auto localBinding = braceElement.dyn_cast<Decl *>()) {
if (isa<AbstractFunctionDecl>(localBinding) ||
isa<TypeDecl>(localBinding))
localBindings.push_back(cast<ValueDecl>(localBinding));
if (auto *vd = dyn_cast<ValueDecl>(localBinding))
localBindings.push_back(vd);
}
}
return consumer.consume(localBindings, DeclVisibilityKind::LocalVariable);
@@ -542,7 +558,7 @@ NullablePtr<const ASTScopeImpl> ASTScopeImpl::ancestorWithDeclSatisfying(
function_ref<bool(const Decl *)> predicate) const {
for (NullablePtr<const ASTScopeImpl> s = getParent(); s;
s = s.get()->getParent()) {
if (Decl *d = s.get()->getDecl().getPtrOrNull()) {
if (Decl *d = s.get()->getDeclIfAny().getPtrOrNull()) {
if (predicate(d))
return s;
}

View File

@@ -38,7 +38,7 @@ using namespace ast_scope;
void ASTScopeImpl::dump() const { print(llvm::errs(), 0, false); }
void ASTScopeImpl::dumpOneScopeMapLocation(
std::pair<unsigned, unsigned> lineColumn) const {
std::pair<unsigned, unsigned> lineColumn) {
auto bufferID = getSourceFile()->getBufferID();
if (!bufferID) {
llvm::errs() << "***No buffer, dumping all scopes***";
@@ -52,7 +52,7 @@ void ASTScopeImpl::dumpOneScopeMapLocation(
llvm::errs() << "***Scope at " << lineColumn.first << ":" << lineColumn.second
<< "***\n";
auto *locScope = findInnermostEnclosingScope(loc);
auto *locScope = findInnermostEnclosingScope(loc, &llvm::errs());
locScope->print(llvm::errs(), 0, false, false);
// Dump the AST context, too.
@@ -92,6 +92,10 @@ void ASTScopeImpl::print(llvm::raw_ostream &out, unsigned level, bool lastChild,
if (auto *a = addressForPrinting().getPtrOrNull())
out << " " << a;
out << ", ";
if (auto *d = getDeclIfAny().getPtrOrNull()) {
if (d->isImplicit())
out << "implicit ";
}
printRange(out);
out << " ";
printSpecifics(out);
@@ -120,11 +124,9 @@ static void printSourceRange(llvm::raw_ostream &out, const SourceRange range,
}
void ASTScopeImpl::printRange(llvm::raw_ostream &out) const {
if (!cachedSourceRange)
if (!isSourceRangeCached(true))
out << "(uncached) ";
SourceRange range = cachedSourceRange
? getSourceRange(/*omitAssertions=*/true)
: getUncachedSourceRange(/*omitAssertions=*/true);
SourceRange range = getUncachedSourceRange(/*omitAssertions=*/true);
printSourceRange(out, range, getSourceManager());
}
@@ -137,7 +139,11 @@ void ASTSourceFileScope::printSpecifics(
}
NullablePtr<const void> ASTScopeImpl::addressForPrinting() const {
if (auto *p = getDecl().getPtrOrNull())
if (auto *p = getDeclIfAny().getPtrOrNull())
return p;
if (auto *p = getStmtIfAny().getPtrOrNull())
return p;
if (auto *p = getExprIfAny().getPtrOrNull())
return p;
return nullptr;
}

View File

@@ -35,22 +35,6 @@ using namespace ast_scope;
static SourceLoc getStartOfFirstParam(ClosureExpr *closure);
SourceRange ASTScopeImpl::getSourceRange(const bool omitAssertions) const {
if (omitAssertions && !cachedSourceRange)
return SourceRange();
assert(cachedSourceRange && "should have been cached after last expandMe");
return *cachedSourceRange;
}
SourceRange
ASTScopeImpl::getUncachedSourceRange(const bool omitAssertions) const {
const auto childlessRange = getChildlessSourceRange();
const auto rangeIncludingIgnoredNodes =
widenSourceRangeForIgnoredASTNodes(childlessRange);
return widenSourceRangeForChildren(rangeIncludingIgnoredNodes,
omitAssertions);
}
SourceRange ASTScopeImpl::widenSourceRangeForIgnoredASTNodes(
const SourceRange range) const {
if (range.isInvalid())
@@ -63,16 +47,11 @@ SourceRange ASTScopeImpl::widenSourceRangeForIgnoredASTNodes(
SourceRange
ASTScopeImpl::widenSourceRangeForChildren(const SourceRange range,
bool omitAssertions) const {
const bool omitAssertions) const {
if (getChildren().empty()) {
assert(omitAssertions || range.Start.isValid());
return range;
}
// If we change the caching to compute the source range lazily,
// the only children required here would be the first and last.
for (auto *c: getChildren())
c->cacheSourceRange();
const auto childStart =
getChildren().front()->getSourceRange(omitAssertions).Start;
const auto childEnd =
@@ -89,11 +68,6 @@ ASTScopeImpl::widenSourceRangeForChildren(const SourceRange range,
#pragma mark validation
bool ASTScopeImpl::verifySourceRange() const {
return verifyThatChildrenAreContained() &&
verifyThatThisNodeComeAfterItsPriorSibling();
}
bool ASTScopeImpl::hasValidSourceRange() const {
const auto sourceRange = getSourceRange();
return sourceRange.Start.isValid() && sourceRange.End.isValid() &&
@@ -112,14 +86,15 @@ bool ASTScopeImpl::precedesInSource(const ASTScopeImpl *next) const {
getSourceRange().End);
}
bool ASTScopeImpl::verifyThatChildrenAreContained() const {
bool ASTScopeImpl::verifyThatChildrenAreContainedWithin(
const SourceRange range) const {
// assumes children are already in order
if (getChildren().empty())
return true;
const SourceRange rangeOfChildren =
SourceRange(getChildren().front()->getSourceRange().Start,
getChildren().back()->getSourceRange().End);
if (getSourceManager().rangeContains(getSourceRange(), rangeOfChildren))
if (getSourceManager().rangeContains(range, rangeOfChildren))
return true;
auto &out = verificationError() << "children not contained in its parent\n";
if (getChildren().size() == 1) {
@@ -149,12 +124,12 @@ bool ASTScopeImpl::verifyThatThisNodeComeAfterItsPriorSibling() const {
print(out);
out << "\n***Parent node***\n";
getParent().get()->print(out);
llvm::errs() << "\n\nsource:\n"
<< getSourceManager()
.getRangeForBuffer(
getSourceFile()->getBufferID().getValue())
.str();
abort();
// llvm::errs() << "\n\nsource:\n"
// << getSourceManager()
// .getRangeForBuffer(
// getSourceFile()->getBufferID().getValue())
// .str();
assert(false && "unexpected out-of-order nodes");
}
NullablePtr<ASTScopeImpl> ASTScopeImpl::getPriorSibling() const {
@@ -178,63 +153,79 @@ NullablePtr<ASTScopeImpl> ASTScopeImpl::getPriorSibling() const {
#pragma mark getChildlessSourceRange
SourceRange SpecializeAttributeScope::getChildlessSourceRange() const {
SourceRange SpecializeAttributeScope::getChildlessSourceRange(
const bool omitAssertions) const {
return specializeAttr->getRange();
}
SourceRange AbstractFunctionBodyScope::getChildlessSourceRange() const {
SourceRange AbstractFunctionBodyScope::getChildlessSourceRange(
const bool omitAssertions) const {
return decl->getBodySourceRange();
}
SourceRange TopLevelCodeScope::getChildlessSourceRange() const {
SourceRange
TopLevelCodeScope::getChildlessSourceRange(const bool omitAssertions) const {
return decl->getSourceRange();
}
SourceRange SubscriptDeclScope::getChildlessSourceRange() const {
SourceRange
SubscriptDeclScope::getChildlessSourceRange(const bool omitAssertions) const {
return decl->getSourceRange();
}
SourceRange WholeClosureScope::getChildlessSourceRange() const {
SourceRange
EnumElementScope::getChildlessSourceRange(const bool omitAssertions) const {
return decl->getSourceRange();
}
SourceRange
WholeClosureScope::getChildlessSourceRange(const bool omitAssertions) const {
return closureExpr->getSourceRange();
}
SourceRange AbstractStmtScope::getChildlessSourceRange() const {
SourceRange
AbstractStmtScope::getChildlessSourceRange(const bool omitAssertions) const {
return getStmt()->getSourceRange();
}
SourceRange DefaultArgumentInitializerScope::getChildlessSourceRange() const {
return decl->getDefaultValue()->getSourceRange();
SourceRange DefaultArgumentInitializerScope::getChildlessSourceRange(
const bool omitAssertions) const {
if (auto *dv = decl->getDefaultValue())
return dv->getSourceRange();
return SourceRange();
}
SourceRange PatternEntryDeclScope::getChildlessSourceRange() const {
SourceRange PatternEntryDeclScope::getChildlessSourceRange(
const bool omitAssertions) const {
// TODO: Once rdar://53627317 is accomplished, the following may be able to be
// simplified.
if (!getChildren().empty()) { // why needed???
bool hasOne = false;
getPattern()->forEachVariable([&](VarDecl *) { hasOne = true; });
if (!hasOne)
return SourceRange(); // just the init
if (!getPatternEntry().getInit())
return SourceRange(); // just the var decls
}
return getPatternEntry().getSourceRange();
}
SourceRange PatternEntryInitializerScope::getChildlessSourceRange() const {
return getPatternEntry().getOriginalInit()->getSourceRange();
SourceRange PatternEntryInitializerScope::getChildlessSourceRange(
const bool omitAssertions) const {
// See rdar://53921703
// Note: grep for "When the initializer is removed we don't actually clear the
// pointer" because we do!
return initAsWrittenWhenCreated->getSourceRange();
}
SourceRange PatternEntryUseScope::getChildlessSourceRange() const {
auto range =
SourceRange(getPatternEntry().getSourceRange(/*omitAccessors*/ true).End,
getPatternEntry().getSourceRange().End);
if (initializerEnd.isValid()) {
// Sigh... If there's a correspinding initializer scope, its range may be
// wider than the pattern decl indicates if it ends in an interpolated
// string literal or editor placeholder.
range.widen(SourceRange(initializerEnd));
range.Start = initializerEnd;
}
return range;
SourceRange
VarDeclScope::getChildlessSourceRange(const bool omitAssertions) const {
const auto br = decl->getBracesRange();
return br.isValid() ? br : decl->getSourceRange();
}
SourceRange VarDeclScope::getChildlessSourceRange() const {
return decl->getBracesRange();
}
SourceRange GenericParamScope::getChildlessSourceRange() const {
SourceRange
GenericParamScope::getChildlessSourceRange(const bool omitAssertions) const {
auto nOrE = holder;
// A protocol's generic parameter list is not written in source, and
// is visible from the start of the body.
@@ -249,7 +240,8 @@ SourceRange GenericParamScope::getChildlessSourceRange() const {
return SourceRange(startLoc, holder->getEndLoc());
}
SourceRange ASTSourceFileScope::getChildlessSourceRange() const {
SourceRange
ASTSourceFileScope::getChildlessSourceRange(const bool omitAssertions) const {
if (auto bufferID = SF->getBufferID()) {
auto charRange = getSourceManager().getRangeForBuffer(*bufferID);
return SourceRange(charRange.getStart(), charRange.getEnd());
@@ -263,13 +255,14 @@ SourceRange ASTSourceFileScope::getChildlessSourceRange() const {
SF->Decls.back()->getEndLoc());
}
SourceRange GenericTypeOrExtensionScope::getChildlessSourceRange() const {
return portion->getChildlessSourceRangeOf(this);
SourceRange GenericTypeOrExtensionScope::getChildlessSourceRange(
const bool omitAssertions) const {
return portion->getChildlessSourceRangeOf(this, omitAssertions);
}
SourceRange GenericTypeOrExtensionWholePortion::getChildlessSourceRangeOf(
const GenericTypeOrExtensionScope *scope) const {
auto *d = scope->getDecl().get();
const GenericTypeOrExtensionScope *scope, const bool omitAssertions) const {
auto *d = scope->getDecl();
auto r = d->getSourceRangeIncludingAttrs();
if (r.Start.isValid()) {
assert(r.End.isValid());
@@ -279,21 +272,24 @@ SourceRange GenericTypeOrExtensionWholePortion::getChildlessSourceRangeOf(
}
SourceRange GenericTypeOrExtensionWherePortion::getChildlessSourceRangeOf(
const GenericTypeOrExtensionScope *scope) const {
const GenericTypeOrExtensionScope *scope, const bool omitAssertions) const {
return scope->getGenericContext()->getTrailingWhereClause()->getSourceRange();
}
SourceRange IterableTypeBodyPortion::getChildlessSourceRangeOf(
const GenericTypeOrExtensionScope *scope) const {
auto *d = scope->getDecl().get();
const GenericTypeOrExtensionScope *scope, const bool omitAssertions) const {
auto *d = scope->getDecl();
if (auto *nt = dyn_cast<NominalTypeDecl>(d))
return nt->getBraces();
if (auto *e = dyn_cast<ExtensionDecl>(d))
return e->getBraces();
if (omitAssertions)
return SourceRange();
llvm_unreachable("No body!");
}
SourceRange AbstractFunctionDeclScope::getChildlessSourceRange() const {
SourceRange AbstractFunctionDeclScope::getChildlessSourceRange(
const bool omitAssertions) const {
// For a get/put accessor all of the parameters are implicit, so start
// them at the start location of the accessor.
auto r = decl->getSourceRangeIncludingAttrs();
@@ -304,30 +300,26 @@ SourceRange AbstractFunctionDeclScope::getChildlessSourceRange() const {
return decl->getBodySourceRange();
}
SourceRange AbstractFunctionParamsScope::getChildlessSourceRange() const {
auto *fn = getEnclosingAbstractFunctionOrSubscriptDecl();
const SourceLoc endLoc = fn->getEndLoc();
// FIXME: Why oh why don't deinitializers have a parameter list?
// clang-format off
SourceLoc startLoc =
isa<AccessorDecl>(fn) ? fn->getLoc() :
isa<DestructorDecl>(fn) ? dyn_cast<DestructorDecl>(fn)->getNameLoc() :
isa<SubscriptDecl>(fn) ? dyn_cast<SubscriptDecl>(fn)->getIndices()->getLParenLoc() :
isa<AbstractFunctionDecl>(fn) ? dyn_cast<AbstractFunctionDecl>(fn)->getParameters()->getLParenLoc() :
SourceLoc();
// clang-format on
const SourceLoc safeEndLocEvenWithBadInput =
getSourceManager().isBeforeInBuffer(startLoc, endLoc) ? endLoc : startLoc;
assert(startLoc.isValid());
return SourceRange(startLoc, safeEndLocEvenWithBadInput);
SourceRange
ParameterListScope::getChildlessSourceRange(const bool omitAssertions) const {
const auto rangeForGoodInput = getSourceRangeOfEnclosedParams(omitAssertions);
auto r = SourceRange(rangeForGoodInput.Start,
fixupEndForBadInput(rangeForGoodInput));
assert(getSourceManager().rangeContains(
getParent().get()->getChildlessSourceRange(true), r) &&
"Parameters not within function?!");
return r;
}
SourceLoc ParameterListScope::fixupEndForBadInput(
const SourceRange rangeForGoodInput) const {
const auto s = rangeForGoodInput.Start;
const auto e = rangeForGoodInput.End;
return getSourceManager().isBeforeInBuffer(s, e) ? e : s;
}
SourceRange ForEachPatternScope::getChildlessSourceRange() const {
SourceRange
ForEachPatternScope::getChildlessSourceRange(const bool omitAssertions) const {
// The scope of the pattern extends from the 'where' expression (if present)
// until the end of the body.
if (stmt->getWhere())
@@ -338,7 +330,8 @@ SourceRange ForEachPatternScope::getChildlessSourceRange() const {
return stmt->getBody()->getSourceRange();
}
SourceRange CatchStmtScope::getChildlessSourceRange() const {
SourceRange
CatchStmtScope::getChildlessSourceRange(const bool omitAssertions) const {
// The scope of the pattern extends from the 'where' (if present)
// to the end of the body.
if (stmt->getGuardExpr())
@@ -347,7 +340,8 @@ SourceRange CatchStmtScope::getChildlessSourceRange() const {
// Otherwise, the scope of the pattern encompasses the body.
return stmt->getBody()->getSourceRange();
}
SourceRange CaseStmtScope::getChildlessSourceRange() const {
SourceRange
CaseStmtScope::getChildlessSourceRange(const bool omitAssertions) const {
// The scope of the case statement begins at the first guard expression,
// if there is one, and extends to the end of the body.
// FIXME: Figure out what to do about multiple pattern bindings. We might
@@ -363,7 +357,8 @@ SourceRange CaseStmtScope::getChildlessSourceRange() const {
->getSourceRange(); // The scope of the case statement begins
}
SourceRange BraceStmtScope::getChildlessSourceRange() const {
SourceRange
BraceStmtScope::getChildlessSourceRange(const bool omitAssertions) const {
// The brace statements that represent closures start their scope at the
// 'in' keyword, when present.
if (auto closure = parentClosureIfAny()) {
@@ -373,7 +368,8 @@ SourceRange BraceStmtScope::getChildlessSourceRange() const {
return stmt->getSourceRange();
}
SourceRange ConditionalClauseScope::getChildlessSourceRange() const {
SourceRange ConditionalClauseScope::getChildlessSourceRange(
const bool omitAssertions) const {
// From the start of this particular condition to the start of the
// then/body part.
const auto startLoc = getStmtConditionElement().getStartLoc();
@@ -382,57 +378,97 @@ SourceRange ConditionalClauseScope::getChildlessSourceRange() const {
: SourceRange(endLoc);
}
SourceRange ConditionalClausePatternUseScope::getChildlessSourceRange() const {
SourceRange ConditionalClausePatternUseScope::getChildlessSourceRange(
const bool omitAssertions) const {
// For a guard continuation, the scope extends from the end of the 'else'
// to the end of the continuation.
return SourceRange(startLoc);
}
SourceRange CaptureListScope::getChildlessSourceRange() const {
SourceRange
CaptureListScope::getChildlessSourceRange(const bool omitAssertions) const {
auto *const closure = expr->getClosureBody();
return SourceRange(expr->getStartLoc(), getStartOfFirstParam(closure));
}
SourceRange ClosureParametersScope::getChildlessSourceRange() const {
assert(closureExpr->getInLoc().isValid() &&
"We don't create these if no in loc");
SourceRange ClosureParametersScope::getChildlessSourceRange(
const bool omitAssertions) const {
if (!omitAssertions)
assert(closureExpr->getInLoc().isValid() &&
"We don't create these if no in loc");
return SourceRange(getStartOfFirstParam(closureExpr),
closureExpr->getInLoc());
}
SourceRange ClosureBodyScope::getChildlessSourceRange() const {
SourceRange
ClosureBodyScope::getChildlessSourceRange(const bool omitAssertions) const {
if (closureExpr->getInLoc().isValid())
return SourceRange(closureExpr->getInLoc(), closureExpr->getEndLoc());
return closureExpr->getSourceRange();
}
SourceRange AttachedPropertyWrapperScope::getChildlessSourceRange() const {
return getCustomAttributesSourceRange(decl);
SourceRange AttachedPropertyWrapperScope::getChildlessSourceRange(
const bool omitAssertions) const {
return sourceRangeWhenCreated;
}
SourceRange GuardStmtUseScope::getChildlessSourceRange() const {
SourceRange LookupParentDiversionScope::getChildlessSourceRange(
const bool omitAssertions) const {
return SourceRange(startLoc);
}
#pragma mark source range caching
void ASTScopeImpl::cacheSourceRange() {
if (cachedSourceRange)
return;
cachedSourceRange = getUncachedSourceRange();
verifySourceRange();
SourceRange ASTScopeImpl::getSourceRange(const bool omitAssertions) const {
if (!isSourceRangeCached(omitAssertions))
cacheSourceRangeOfMeAndDescendants(omitAssertions);
return *cachedSourceRange;
}
void ASTScopeImpl::clearSourceRangeCache() { cachedSourceRange = None; }
void ASTScopeImpl::cacheSourceRangesOfSlice() {
cacheSourceRange();
for (auto *s = this->getParent().getPtrOrNull(); s;
s = s->getParent().getPtrOrNull())
s->cacheSourceRange();
bool ASTScopeImpl::isSourceRangeCached(const bool omitAssertions) const {
const bool isCached = cachedSourceRange.hasValue();
assert(omitAssertions || isCached || ensureNoAncestorsSourceRangeIsCached());
return isCached;
}
bool ASTScopeImpl::ensureNoAncestorsSourceRangeIsCached() const {
if (const auto *const p = getParent().getPtrOrNull()) {
auto r = !p->isSourceRangeCached(true) &&
p->ensureNoAncestorsSourceRangeIsCached();
if (!r)
llvm_unreachable("found a violation");
return true;
}
return true;
}
void ASTScopeImpl::cacheSourceRangeOfMeAndDescendants(
const bool omitAssertions) const {
// In order to satisfy the invariant that, if my range is uncached,
// my parent's range is uncached, (which is needed to optimize invalidation
// by obviating the need to uncache all the way to the root every time),
// when caching a range, must ensure all children's ranges are cached.
for (auto *c : getChildren())
c->cacheSourceRangeOfMeAndDescendants(omitAssertions);
cachedSourceRange = getUncachedSourceRange(omitAssertions);
}
SourceRange
ASTScopeImpl::getUncachedSourceRange(const bool omitAssertions) const {
const auto childlessRange = getChildlessSourceRange(omitAssertions);
const auto rangeIncludingIgnoredNodes =
widenSourceRangeForIgnoredASTNodes(childlessRange);
return widenSourceRangeForChildren(rangeIncludingIgnoredNodes,
omitAssertions);
}
void ASTScopeImpl::clearCachedSourceRangesOfMeAndAncestors() {
clearSourceRangeCache();
// An optimization: if my range isn't cached, my ancestors must not be
if (!isSourceRangeCached())
return;
cachedSourceRange = None;
if (auto p = getParent())
p.get()->clearCachedSourceRangesOfMeAndAncestors();
}
@@ -509,3 +545,48 @@ static SourceLoc getStartOfFirstParam(ClosureExpr *closure) {
return closure->getBody()->getLBraceLoc();
return closure->getStartLoc();
}
#pragma mark getSourceRangeOfEnclosedParams
SourceRange
ASTScopeImpl::getSourceRangeOfEnclosedParams(const bool omitAssertions) const {
return getParent().get()->getSourceRangeOfEnclosedParams(omitAssertions);
}
SourceRange
EnumElementScope::getSourceRangeOfEnclosedParams(bool omitAssertions) const {
auto *pl = decl->getParameterList();
return pl ? pl->getSourceRange() : SourceRange();
}
SourceRange SubscriptDeclScope::getSourceRangeOfEnclosedParams(
const bool omitAssertions) const {
auto r = SourceRange(decl->getIndices()->getLParenLoc(), decl->getEndLoc());
// Because of "subscript(x: MyStruct#^PARAM_1^#) -> Int { return 0 }"
// Cannot just use decl->getEndLoc()
r.widen(decl->getIndices()->getRParenLoc());
return r;
}
SourceRange AbstractFunctionDeclScope::getSourceRangeOfEnclosedParams(
const bool omitAssertions) const {
const auto s = getParamsSourceLoc(decl);
const auto e = getChildlessSourceRange(omitAssertions).End;
return s.isInvalid() || e.isInvalid() ? SourceRange() : SourceRange(s, e);
}
SourceLoc
AbstractFunctionDeclScope::getParamsSourceLoc(AbstractFunctionDecl *decl) {
if (auto *c = dyn_cast<ConstructorDecl>(decl))
return c->getParameters()->getLParenLoc();
if (auto *dd = dyn_cast<DestructorDecl>(decl))
return dd->getNameLoc();
auto *fd = cast<FuncDecl>(decl);
// clang-format off
return isa<AccessorDecl>(fd) ? fd->getLoc()
: fd->isDeferBody() ? fd->getNameLoc()
: fd->getParameters()->getLParenLoc();
// clang-format on
}

View File

@@ -2441,6 +2441,13 @@ public:
abort();
}
}
// if (auto *VD = dyn_cast<VarDecl>(ASD->getStorage())) {
// const bool foundIt =
// llvm::any_of(vd->getAllAccessors(),
// [&](AccessorDecl *VDA) { return VDA == ASD; });
// Out << "Accessor for a VarDecl must be listed in its accessors";
// abort();
// }
verifyCheckedBase(ASD);
}

View File

@@ -155,6 +155,22 @@ BraceStmt *BraceStmt::create(ASTContext &ctx, SourceLoc lbloc,
assert(std::none_of(elts.begin(), elts.end(),
[](ASTNode node) -> bool { return node.isNull(); }) &&
"null element in BraceStmt");
// Uncomment the following after rdar://53254395 is done:
// if (
// !std::is_sorted(
// elts.begin(), elts.end(),
// [&](ASTNode n1, ASTNode n2) {
// return !ctx.SourceMgr.isBeforeInBuffer(n2.getEndLoc(),
// n1.getEndLoc());
// })) {
// llvm::errs() << "Brace statement elements out of order: \n";
// for (auto n: elts) {
// llvm::errs() << n.getOpaqueValue() << ": ";
// n.dump(llvm::errs());
// }
// llvm_unreachable("brace elements out of order")
// }
void *Buffer = ctx.Allocate(totalSizeToAlloc<ASTNode>(elts.size()),
alignof(BraceStmt));
return ::new(Buffer) BraceStmt(lbloc, elts, rbloc, implicit);

View File

@@ -1332,7 +1332,7 @@ bool UnqualifiedLookupFactory::verifyEqualTo(
e.getValueDecl()->print(as);
oe.getValueDecl()->print(bs);
if (a == b)
llvm::errs() << "ValueDecls differ but print same";
llvm::errs() << "ValueDecls differ but print same\n";
else {
writeErr(std::string( "ValueDecls differ at ") + std::to_string(i));
assert(false && "ASTScopeImpl found different Decl");

View File

@@ -745,7 +745,8 @@ static void verifyGenericSignaturesIfNeeded(CompilerInvocation &Invocation,
static void dumpAndPrintScopeMap(CompilerInvocation &Invocation,
CompilerInstance &Instance, SourceFile *SF) {
const ASTScope &scope = SF->getScope();
// Not const because may require reexpansion
ASTScope &scope = SF->getScope();
if (Invocation.getFrontendOptions().DumpScopeMapLocations.empty()) {
llvm::errs() << "***Complete scope map***\n";

View File

@@ -1,241 +0,0 @@
// REQUIRES: enable-astscope-lookup
// RUN: %target-swift-frontend -typecheck %s -module-name themodule -enable-source-import -I %S/../decl/enum -sdk "" -verify -show-diagnostics-after-fatal -verify-ignore-unknown
// -verify-ignore-unknown is for
// <unknown>:0: error: unexpected note produced: did you forget to set an SDK using -sdk or SDKROOT?
// <unknown>:0: error: unexpected note produced: use "xcrun swiftc" to select the default macOS SDK installed with Xcode
import Swift
import nonexistentimport // expected-error {{no such module 'nonexistentimport'}}
//===----------------------------------------------------------------------===//
// Test imported names
//===----------------------------------------------------------------------===//
// Imported from swift stdlib.
var importedtype : Int
// Imported from enumtest module.
import enum enumtest.unionSearchFlags
var importedunion: unionSearchFlags = .backwards
// This shouldn't be imported from data.
var notimported : MaybeInt // expected-error {{use of undeclared type 'MaybeInt'}}
//===----------------------------------------------------------------------===//
// Name binding stress test
//===----------------------------------------------------------------------===//
var callee1 : () -> (Int,Int,Int) // Takes nothing, returns tuple.
func test_shadowing() {
// Shadow Int.
enum Int { case xyz; case abc }
// We get the shadowed version of Int.
var _ : Int = .abc
}
func unknown_member() {
var error = Swift.nonexistent_member // expected-error {{module 'Swift' has no member named 'nonexistent_member'}}
}
//===----------------------------------------------------------------------===//
// varname Processing
//===----------------------------------------------------------------------===//
var varname1 : (a : Int, b : Int)
// Not very useful, but it is allowed.
var (varname2_a, varname2_b) : (a : Int, b : Int) = varname1
func test_varname_binding() {
var c = (4, 5)
var (d, e) = (c.1, c.0)
var ((), (g1, g2), h) = ((), (e, d), e)
var (j, k, l) = callee1()
var (m, n) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _)', tuples have a different number of elements}}
var (o, p, q, r) = callee1() // expected-error{{'(Int, Int, Int)' is not convertible to '(_, _, _, _)', tuples have a different number of elements}}
}
//===----------------------------------------------------------------------===//
// ForwardIndex referencing of types.
//===----------------------------------------------------------------------===//
// We don't allow namebinding to look forward past a var declaration in the
// main module
var x : x_ty // expected-error {{use of undeclared type 'x_ty'}}
// expected-note@-1 {{did you mean 'x'?}}
// FIXME: That's a terrible note!
typealias x_ty = Int
// We allow namebinding to look forward past a function declaration (and other
// declarations which never have side-effects) in the main module
func fy() -> y_ty { return 1 }
typealias y_ty = Int
// FIXME: Should reject this!
//typealias x = x
// FIXME: Should reject this (has infinite size or is tautological depend on
// how you look at it).
enum y { // expected-note {{did you mean 'y'?}}
// FIXME: That's a terrible note!
case y
case Int
}
// We don't have a typeof, but this would also be an error somehow.
//var x : typeof(x)
//===----------------------------------------------------------------------===//
// ForwardIndex referencing of values.
//===----------------------------------------------------------------------===//
func func2() {
func3()
}
func func3() {
undefined_func() // expected-error {{use of unresolved identifier 'undefined_func'}}
}
//===----------------------------------------------------------------------===//
// Overloading
//===----------------------------------------------------------------------===//
struct a_struct { var x : Int }
infix operator *** : Starry
precedencegroup Starry {
associativity: left
higherThan: AssignmentPrecedence
lowerThan: TernaryPrecedence
}
func ***(lhs: Int, rhs: Int) -> Int {
return 4
}
func ***(lhs: a_struct, rhs: a_struct) {}
func ***(lhs: a_struct, rhs: (Int) -> Int) {}
func ov_fn_result() -> Int {}
func ov_fn_result() -> Double {}
func ov_fn_result2() -> (Int) -> (Int) -> Int {}
func ov_fn_result2() -> (Int) -> (a_struct) -> Int {}
func overloadtest(x: Int) {
var _ : Int = ((ov_fn_result))()
var _ : Double = ((ov_fn_result))()
// Test overloaded operators.
let s : a_struct
_ = 4 *** 17 // Resolved to the *** operator that takes ints.
s *** s // Resolved to the *** operator that takes a_struct.
s *** {$0 + 4} // Closure obviously not a struct.
_ = ov_fn_result2()(4)(4) // picks the ov_fn_result2 taking an Int.
_ = ov_fn_result2()(4)(s) // picks the ov_fn_result2 taking a_struct.
}
func localtest() {
func shadowbug() {
var Foo = 10
func g() {
struct S {
// FIXME: Swap these two lines to crash our broken lookup.
typealias Foo = Int
var x : Foo
}
}
}
func scopebug() {
var Foo = 10
struct S {
typealias Foo = Int
}
Foo = 17
_ = Foo
}
func scopebug2() {
struct S1 {}
struct S2 {
var x : S1
}
}
}
func f0() -> ThisTypeDoesNotExist { return 1 } // expected-error {{use of undeclared type 'ThisTypeDoesNotExist'}}
for _ in [1] { }
//===----------------------------------------------------------------------===//
// Accessing names from our own module
//===----------------------------------------------------------------------===//
var qualifiedvalue : Int = themodule.importedtype
var qualifiedtype : themodule.x_ty = 5
prefix operator +++
postfix operator +++
prefix operator ++
postfix operator ++
prefix func +++(a: inout Int) { a += 2 }
postfix func +++(a: inout Int) { a += 2 }
var test = 0
+++test
test+++
//===----------------------------------------------------------------------===//
// Forward references to local variables.
//===----------------------------------------------------------------------===//
func forwardReference() {
v = 0 // expected-error{{use of unresolved identifier 'v'}}
var v: Float = 0.0
}
class ForwardReference {
var x: Int = 0
func test() {
x = 0
var x: Float = 0.0 // expected-warning{{variable 'x' was never used; consider replacing with '_' or removing it}}
}
}
func questionablyValidForwardReference() { print(qvfrVar, terminator: ""); }; var qvfrVar: Int = 0
// FIXME: This should warn too.
print(forwardReferenceVar, terminator: ""); var forwardReferenceVar: Int = 0
// <rdar://problem/23248290> Name lookup: "Cannot convert type 'Int' to expected argument type 'Int'" while trying to initialize ivar of generic type in class scope
// https://gist.github.com/erynofwales/61768899502b7ac83c6e
struct Matrix4<T: FloatingPoint> {
static func size() -> Int {}
private var data: Int = Matrix4.size() // Ok: Matrix4<T>
init() {
data = Matrix4.size() // Ok: Matrix4<T>
}
}
// <rdar://problem/19558785> for-in collection/where expressions are parsed with pattern variables in scope
func r19558785() {
let b = 10
for b in 0...b {
_ = b
}
}

View File

@@ -1,4 +1,3 @@
// XFAIL: enable-astscope-lookup
// RUN: %target-swift-frontend -typecheck %s -module-name themodule -enable-source-import -I %S/../decl/enum -sdk "" -verify -show-diagnostics-after-fatal -verify-ignore-unknown
// -verify-ignore-unknown is for

View File

@@ -199,7 +199,7 @@ class LazyProperties {
// CHECK-EXPANDED: ***Complete scope map***
// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, [1:1 - 52{{[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{{[/]}}NameBinding{{[/]}}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'
@@ -210,6 +210,9 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [12:10 - 13:1] 'C0'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [15:1 - 18:1] 'E0'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [15:9 - 18:1] 'E0'
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [16:8 - 16:8]
// CHECK-EXPANDED-NEXT: `-EnumElementScope {{.*}}, [17:8 - 17:19]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [17:10 - 17:19]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [20:1 - 21:1] 'GenericS0'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [20:18 - 21:1] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [20:21 - 21:1] param 1 'U'
@@ -217,7 +220,7 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [23:1 - 24:1] 'genericFunc0(t:u:i:)'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [23:19 - 24:1] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [23:22 - 24:1] param 1 'U'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [23:24 - 24:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [23:24 - 24:1]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [23:46 - 23:46]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [23:50 - 24:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [23:50 - 24:1]
@@ -226,11 +229,11 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [27:3 - 28:3] 'init(t:u:)'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [27:8 - 28:3] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [27:11 - 28:3] param 1 'U'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [27:13 - 28:3]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [27:13 - 28:3]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [27:26 - 28:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [27:26 - 28:3]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [30:3 - 31:3] 'deinit'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [30:3 - 31:3]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [30:3 - 31:3]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [30:10 - 31:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [30:10 - 31:3]
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [34:1 - 34:32] <no extended nominal?!>
@@ -238,176 +241,159 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [39:1 - 39:26] 'OtherArchStruct'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [39:24 - 39:26] 'OtherArchStruct'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [42:1 - 101:1] 'functionBodies1(a:b:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [42:21 - 101:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [42:21 - 101:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [42:39 - 101:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [42:39 - 101:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [43:7 - 100:38] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [43:18 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [43:23 - 100:38] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [44:7 - 100:38] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [44:18 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [44:23 - 100:38] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [45:7 - 100:38] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [45:18 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [45:23 - 100:38] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [46:6 - 53:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [47:9 - 52:5] entry 0 'a1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [47:14 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [47:14 - 52:5] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [48:9 - 52:5] entry 0 'a2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [48:14 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [48:14 - 52:5] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [49:8 - 52:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [50:11 - 51:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [50:16 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [50:16 - 51:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [51:11 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [54:6 - 57:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [55:9 - 56:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [55:14 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [55:14 - 56:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [56:9 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [58:3 - 58:38] 'f(_:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [58:9 - 58:38]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [59:7 - 100:38] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [59:12 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [59:16 - 100:38] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [60:3 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [60:13 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [61:3 - 61:23] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-IfStmtScope {{.*}}, [63:3 - 67:3]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [63:6 - 65:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:18 - 65:3] let b1
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [63:18 - 65:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:29 - 65:3] let b2
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [63:29 - 65:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [64:9 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [65:10 - 67:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [66:9 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [69:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [69:9 - 69:53] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:21 - 69:53] let b1
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:21 - 69:53] index 1
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:37 - 69:53] index 2
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:53 - 69:53] let b2
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [70:9 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-GuardStmtUseScope, [72:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-WhileStmtScope {{.*}}, [74:3 - 76:3]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:9 - 76:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:21 - 76:3] let b3
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:21 - 76:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:32 - 76:3] let b4
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [74:32 - 76:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [75:9 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-RepeatWhileScope {{.*}}, [78:3 - 78:20]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [78:10 - 78:12]
// CHECK-EXPANDED-NEXT: |-ForEachStmtScope {{.*}}, [80:3 - 82:3]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope {{.*}}, [80:52 - 82:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [80:63 - 82:3]
// CHECK-EXPANDED-NEXT: |-DoCatchStmtScope {{.*}}, [84:3 - 88:3]
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [84:6 - 86:3]
// CHECK-EXPANDED-NEXT: |-CatchStmtScope {{.*}}, [86:31 - 87:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [86:54 - 87:3]
// CHECK-EXPANDED-NEXT: `-CatchStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: |-SwitchStmtScope {{.*}}, [90:3 - 99:3]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [91:29 - 92:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [92:5 - 92:10]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-CaseStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-ForEachStmtScope {{.*}}, [100:3 - 100:38]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [43:7 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [43:18 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [44:7 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [44:18 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [45:7 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [45:18 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [46:6 - 53:3]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [47:9 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [47:14 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [48:9 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [48:14 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [49:8 - 52:5]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [50:11 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [50:16 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [51:11 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [54:6 - 57:3]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [55:9 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [55:14 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [56:9 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [58:3 - 58:38] 'f(_:)'
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [58:9 - 58:38]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [59:7 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [59:12 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [60:3 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [60:13 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [61:3 - 61:23] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-IfStmtScope {{.*}}, [63:3 - 67:3]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [63:6 - 65:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:18 - 65:3] let b1
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [63:18 - 65:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:29 - 65:3] let b2
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [63:29 - 65:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [64:9 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [65:10 - 67:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [66:9 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [69:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [69:9 - 69:53] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:21 - 69:53] let b1
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:21 - 69:53] index 1
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:37 - 69:53] index 2
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:53 - 69:53] let b2
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [70:9 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-LookupParentDiversionScope, [72:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-WhileStmtScope {{.*}}, [74:3 - 76:3]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:9 - 76:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:21 - 76:3] let b3
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:21 - 76:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:32 - 76:3] let b4
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [74:32 - 76:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [75:9 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-RepeatWhileScope {{.*}}, [78:3 - 78:20]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [78:10 - 78:12]
// CHECK-EXPANDED-NEXT: |-ForEachStmtScope {{.*}}, [80:3 - 82:3]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope, [80:52 - 82:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [80:63 - 82:3]
// CHECK-EXPANDED-NEXT: |-DoCatchStmtScope {{.*}}, [84:3 - 88:3]
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [84:6 - 86:3]
// CHECK-EXPANDED-NEXT: |-CatchStmtScope {{.*}}, [86:31 - 87:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [86:54 - 87:3]
// CHECK-EXPANDED-NEXT: `-CatchStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: |-SwitchStmtScope {{.*}}, [90:3 - 99:3]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [91:29 - 92:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [92:5 - 92:10]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-CaseStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-ForEachStmtScope {{.*}}, [100:3 - 100:38]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [103:1 - 103:26] 'throwing()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [103:14 - 103:26]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [103:14 - 103:26]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [103:24 - 103:26]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [103:24 - 103:26]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [105:1 - 107:1] 'MyError'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [105:24 - 107:1] 'MyError'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [106:7 - 106:14] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [106:14 - 106:14] entry 0 'value'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [109:1 - 113:1] 'MyEnum'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [109:13 - 113:1] 'MyEnum'
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [110:8 - 110:8]
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [111:8 - 111:18]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [111:14 - 111:18]
// 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: `-AbstractFunctionParamsScope {{.*}}, [116:13 - 122:3]
// 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: `-ParameterListScope {{.*}}, [116:13 - 122:3]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [117:5 - 118:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [117:9 - 118:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [117:9 - 118:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [119:5 - 121:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [119:9 - 121:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [119:9 - 121:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [124:7 - 130:3] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [124:17 - 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: |-AbstractFunctionDeclScope {{.*}}, [125:5 - 127:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [125:9 - 127:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [125:9 - 127:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [128:5 - 129:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [128:9 - 129: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: |-AbstractFunctionDeclScope {{.*}}, [125:5 - 127:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [125:9 - 127:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [125:9 - 127:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [128:5 - 129:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [133:1 - 141:1] 'ClassWithComputedProperties'
// 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: `-PatternEntryUseScope {{.*}}, [134:30 - 136:3] 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: `-AbstractFunctionDeclScope {{.*}}, [135:5 - 135:15] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [135:13 - 135:15]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [135:13 - 135:15]
// 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: `-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: `-PatternEntryUseScope {{.*}}, [138:29 - 140:3] 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: `-AbstractFunctionDeclScope {{.*}}, [139:5 - 139:14] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [139:12 - 139:14]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [139:12 - 139:14]
// 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: `-AbstractFunctionDeclScope {{.*}}, [139:5 - 139:14] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [139:12 - 139:14]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [139:12 - 139:14]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [143:1 - 156:1] 'funcWithComputedProperties(i:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [143:32 - 156:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [143:32 - 156:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [143:41 - 156:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [143:41 - 156:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [144:7 - 155:8] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [144:17 - 155:8] 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: |-AbstractFunctionDeclScope {{.*}}, [145:5 - 146:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [145:9 - 146:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [145:9 - 146:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [147:5 - 149:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [150:6 - 155:8] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [150:31 - 150:36] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [150:36 - 155:8] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [151:3 - 155:8] entry 2 'alsoComputed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [151:21 - 155:8] 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: `-AbstractFunctionDeclScope {{.*}}, [151:25 - 153:3] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [151:25 - 153:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [151:25 - 153:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [155:6 - 155:8]
// 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: |-AbstractFunctionDeclScope {{.*}}, [145:5 - 146:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [145:9 - 146:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [145:9 - 146:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [147:5 - 149:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [147:9 - 149:5]
// 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: `-AbstractFunctionDeclScope {{.*}}, [151:25 - 153:3] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [151:25 - 153:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [151:25 - 153:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [155:6 - 155:8]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [158:1 - 163:1] 'closures()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [158:14 - 163:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [158:14 - 163:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [158:17 - 163:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [158:17 - 163:1]
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [159:3 - 161:3]
@@ -427,7 +413,7 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [165:1 - 165:14]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [165:1 - 165:14]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [167:1 - 176:1] 'defaultArguments(i:j:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [167:22 - 176:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [167:22 - 176:1]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [167:32 - 167:32]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [168:32 - 168:48]
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [168:32 - 168:42]
@@ -436,7 +422,7 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [168:51 - 176:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [168:51 - 176:1]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [170:3 - 172:3] 'localWithDefaults(i:j:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [170:25 - 172:3]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [170:25 - 172:3]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [170:35 - 170:35]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [171:35 - 171:51]
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [171:35 - 171:45]
@@ -445,77 +431,72 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [171:54 - 172:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [171:54 - 172:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [174:7 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [174:11 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [174:11 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [175:11 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [178:1 - 181:1] 'PatternInitializers'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [178:28 - 181:1] 'PatternInitializers'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [179:7 - 180:25] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [179:16 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [179:21 - 180:25] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [180:7 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [180:16 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [180:25 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [179:7 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [179:16 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [180:7 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [180:16 - 180:25] entry 1 'c' 'd'
// 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: `-AbstractFunctionParamsScope {{.*}}, [184:12 - 184:43]
// 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: `-ParameterListScope {{.*}}, [184:12 - 184:43]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [184:35 - 184:35] '_'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [184:39 - 184:39] '_'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [187:1 - 189:1] 'localPatternsWithSharedType()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [187:33 - 189:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [187:33 - 189:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [187:36 - 189:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [187:36 - 189:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:7 - 188:16] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:7 - 188:16] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:10 - 188:16] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:10 - 188:16] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:13 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:16 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [188:7 - 188:7] entry 0 'i'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [188:10 - 188:10] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:13 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: `-NominalTypeDeclScope {{.*}}, [191:1 - 195:1] 'LazyProperties'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [191:22 - 195:1] 'LazyProperties'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [192:7 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [194:12 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [194:24 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [194:29 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [194:24 - 194:29] entry 0 'prop'
// RUN: not %target-swift-frontend -dump-scope-maps 71:8,27:20,6:18,167:32,180:18,194:26 %s 2> %t.searches
// RUN: %FileCheck -check-prefix CHECK-SEARCHES %s < %t.searches
// CHECK-SEARCHES: ***Scope at 71:8***
// CHECK-SEARCHES-NEXT: BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-SEARCHES-NEXT: BraceStmtScope {{.*}}, [69:53 - 7{{[0-9]}}:3]
// CHECK-SEARCHES-NEXT: Local bindings: c
// CHECK-SEARCHES-NEXT: ***Scope at 27:20***
// CHECK-SEARCHES-NEXT: AbstractFunctionParamsScope {{.*}}, [27:13 - 28:3]
// CHECK-SEARCHES-NEXT: ParameterListScope {{.*}}, [27:13 - 28:3]
// 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/NameBinding/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/NameBinding/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/NameBinding/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/NameBinding/scope_map-astscopelookup.swift"
// CHECK-SEARCHES-NEXT: {{.*}} ClassDecl name=LazyProperties
// CHECK-SEARCHES-NEXT: {{.*}} Initializer PatternBinding {{.*}} #0
// CHECK-SEARCHES-NEXT: Local bindings: self
// CHECK-SEARCHES-NOT: ***Complete scope map***

View File

@@ -199,7 +199,7 @@ class LazyProperties {
// CHECK-EXPANDED: ***Complete scope map***
// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, [1:1 - 52{{[0-9]}}:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.swift'
// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 5{{[0-9]*}}:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.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'
@@ -210,6 +210,9 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [12:10 - 13:1] 'C0'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [15:1 - 18:1] 'E0'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [15:9 - 18:1] 'E0'
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [16:8 - 16:8]
// CHECK-EXPANDED-NEXT: `-EnumElementScope {{.*}}, [17:8 - 17:19]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [17:10 - 17:19]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [20:1 - 21:1] 'GenericS0'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [20:18 - 21:1] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [20:21 - 21:1] param 1 'U'
@@ -217,7 +220,7 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [23:1 - 24:1] 'genericFunc0(t:u:i:)'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [23:19 - 24:1] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [23:22 - 24:1] param 1 'U'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [23:24 - 24:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [23:24 - 24:1]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [23:46 - 23:46]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [23:50 - 24:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [23:50 - 24:1]
@@ -226,11 +229,11 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [27:3 - 28:3] 'init(t:u:)'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [27:8 - 28:3] param 0 'T'
// CHECK-EXPANDED-NEXT: `-GenericParamScope {{.*}}, [27:11 - 28:3] param 1 'U'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [27:13 - 28:3]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [27:13 - 28:3]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [27:26 - 28:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [27:26 - 28:3]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [30:3 - 31:3] 'deinit'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [30:3 - 31:3]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [30:3 - 31:3]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [30:10 - 31:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [30:10 - 31:3]
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [34:1 - 34:32] <no extended nominal?!>
@@ -238,176 +241,159 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [39:1 - 39:26] 'OtherArchStruct'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [39:24 - 39:26] 'OtherArchStruct'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [42:1 - 101:1] 'functionBodies1(a:b:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [42:21 - 101:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [42:21 - 101:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [42:39 - 101:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [42:39 - 101:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [43:7 - 100:38] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [43:18 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [43:23 - 100:38] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [44:7 - 100:38] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [44:18 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [44:23 - 100:38] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [45:7 - 100:38] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [45:18 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [45:23 - 100:38] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [46:6 - 53:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [47:9 - 52:5] entry 0 'a1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [47:14 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [47:14 - 52:5] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [48:9 - 52:5] entry 0 'a2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [48:14 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [48:14 - 52:5] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [49:8 - 52:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [50:11 - 51:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [50:16 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [50:16 - 51:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [51:11 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [54:6 - 57:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [55:9 - 56:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [55:14 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [55:14 - 56:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [56:9 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [58:3 - 58:38] 'f(_:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [58:9 - 58:38]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [59:7 - 100:38] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [59:12 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [59:16 - 100:38] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [60:3 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [60:13 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [61:3 - 61:23] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-IfStmtScope {{.*}}, [63:3 - 67:3]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [63:6 - 65:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:18 - 65:3] let b1?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [63:18 - 65:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:29 - 65:3] let b2?
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [63:29 - 65:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [64:9 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [65:10 - 67:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [66:9 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [69:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [69:9 - 69:53] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:21 - 69:53] let b1?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:21 - 69:53] index 1
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:37 - 69:53] index 2
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:53 - 69:53] let b2?
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [70:9 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-GuardStmtUseScope, [72:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-WhileStmtScope {{.*}}, [74:3 - 76:3]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:9 - 76:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:21 - 76:3] let b3?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:21 - 76:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:32 - 76:3] let b4?
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [74:32 - 76:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [75:9 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-RepeatWhileScope {{.*}}, [78:3 - 78:20]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [78:10 - 78:12]
// CHECK-EXPANDED-NEXT: |-ForEachStmtScope {{.*}}, [80:3 - 82:3]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope {{.*}}, [80:52 - 82:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [80:63 - 82:3]
// CHECK-EXPANDED-NEXT: |-DoCatchStmtScope {{.*}}, [84:3 - 88:3]
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [84:6 - 86:3]
// CHECK-EXPANDED-NEXT: |-CatchStmtScope {{.*}}, [86:31 - 87:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [86:54 - 87:3]
// CHECK-EXPANDED-NEXT: `-CatchStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: |-SwitchStmtScope {{.*}}, [90:3 - 99:3]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [91:29 - 92:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [92:5 - 92:10]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-CaseStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-ForEachStmtScope {{.*}}, [100:3 - 100:38]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [43:7 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [43:18 - 43:23] entry 0 'x1' 'x2'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [44:7 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [44:18 - 44:23] entry 1 'y1' 'y2'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [45:7 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [45:18 - 45:23] entry 0 'z1' 'z2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [46:6 - 53:3]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [47:9 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [47:14 - 47:14] entry 0 'a1'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [48:9 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [48:14 - 48:14] entry 0 'a2'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [49:8 - 52:5]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [50:11 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [50:16 - 50:16] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [51:11 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [51:16 - 51:16] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [54:6 - 57:3]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [55:9 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [55:14 - 55:14] entry 0 'b1'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [56:9 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [56:14 - 56:14] entry 0 'b2'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [58:3 - 58:38] 'f(_:)'
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [58:9 - 58:38]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [58:27 - 58:38]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [59:7 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [59:12 - 59:16] entry 0 'f2'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [60:3 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [60:13 - 60:15] 'S7'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [61:3 - 61:23] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-IfStmtScope {{.*}}, [63:3 - 67:3]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [63:6 - 65:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:18 - 65:3] let b1?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [63:18 - 65:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [63:29 - 65:3] let b2?
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [63:29 - 65:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [64:9 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [64:14 - 64:14] entry 0 'c1'
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [65:10 - 67:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [66:9 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [66:14 - 66:14] entry 0 'c2'
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [69:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [69:9 - 69:53] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:21 - 69:53] let b1?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:21 - 69:53] index 1
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [69:21 - 69:30]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [69:37 - 69:53] index 2
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [69:53 - 69:53] let b2?
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [70:9 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [70:13 - 70:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-LookupParentDiversionScope, [72:3 - 100:38]
// CHECK-EXPANDED-NEXT: |-WhileStmtScope {{.*}}, [74:3 - 76:3]
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:9 - 76:3] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:21 - 76:3] let b3?
// CHECK-EXPANDED-NEXT: `-ConditionalClauseScope, [74:21 - 76:3] index 1
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [74:32 - 76:3] let b4?
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [74:32 - 76:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [75:9 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [75:13 - 75:13] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-RepeatWhileScope {{.*}}, [78:3 - 78:20]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [78:10 - 78:12]
// CHECK-EXPANDED-NEXT: |-ForEachStmtScope {{.*}}, [80:3 - 82:3]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope, [80:52 - 82:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [80:63 - 82:3]
// CHECK-EXPANDED-NEXT: |-DoCatchStmtScope {{.*}}, [84:3 - 88:3]
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [84:6 - 86:3]
// CHECK-EXPANDED-NEXT: |-CatchStmtScope {{.*}}, [86:31 - 87:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [86:54 - 87:3]
// CHECK-EXPANDED-NEXT: `-CatchStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [87:11 - 88:3]
// CHECK-EXPANDED-NEXT: |-SwitchStmtScope {{.*}}, [90:3 - 99:3]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [91:29 - 92:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [92:5 - 92:10]
// CHECK-EXPANDED-NEXT: |-CaseStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [95:5 - 95:10]
// CHECK-EXPANDED-NEXT: `-CaseStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [98:5 - 98:10]
// CHECK-EXPANDED-NEXT: `-ForEachStmtScope {{.*}}, [100:3 - 100:38]
// CHECK-EXPANDED-NEXT: `-ForEachPatternScope, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [100:36 - 100:38]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [103:1 - 103:26] 'throwing()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [103:14 - 103:26]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [103:14 - 103:26]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [103:24 - 103:26]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [103:24 - 103:26]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [105:1 - 107:1] 'MyError'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [105:24 - 107:1] 'MyError'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [106:7 - 106:14] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [106:14 - 106:14] entry 0 'value'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [109:1 - 113:1] 'MyEnum'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [109:13 - 113:1] 'MyEnum'
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [110:8 - 110:8]
// CHECK-EXPANDED-NEXT: |-EnumElementScope {{.*}}, [111:8 - 111:18]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [111:14 - 111:18]
// 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] scope_map.(file).StructContainsAbstractStorageDecls.subscript(_:_:)@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.swift:116:3
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [116:13 - 122:3]
// CHECK-EXPANDED-NEXT: |-SubscriptDeclScope {{.*}}, [116:3 - 122:3] scope_map.(file).StructContainsAbstractStorageDecls.subscript(_:_:)@SOURCE_DIR/test/NameBinding/scope_map.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]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [117:9 - 118:5]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [119:5 - 121:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [119:9 - 121:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [119:9 - 121:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [124:7 - 130:3] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [124:17 - 130:3] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [124:21 - 130:3] scope_map.(file).StructContainsAbstractStorageDecls.computed@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.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]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [128:5 - 129:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [124:21 - 130:3] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [124:21 - 130:3] scope_map.(file).StructContainsAbstractStorageDecls.computed@SOURCE_DIR/test/NameBinding/scope_map.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]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [128:5 - 129:5] '_'
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [128:9 - 129:5]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [133:1 - 141:1] 'ClassWithComputedProperties'
// 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: `-PatternEntryUseScope {{.*}}, [134:30 - 136:3] entry 0 'willSetProperty'
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [134:32 - 136:3] scope_map.(file).ClassWithComputedProperties.willSetProperty@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.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: `-VarDeclScope {{.*}}, [134:32 - 136:3] scope_map.(file).ClassWithComputedProperties.willSetProperty@SOURCE_DIR/test/NameBinding/scope_map.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: `-PatternEntryUseScope {{.*}}, [138:29 - 140:3] entry 0 'didSetProperty'
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [138:31 - 140:3] scope_map.(file).ClassWithComputedProperties.didSetProperty@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.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]
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [138:31 - 140:3] scope_map.(file).ClassWithComputedProperties.didSetProperty@SOURCE_DIR/test/NameBinding/scope_map.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]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [143:1 - 156:1] 'funcWithComputedProperties(i:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [143:32 - 156:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [143:32 - 156:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [143:41 - 156:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [143:41 - 156:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [144:7 - 155:8] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [144:17 - 155:8] entry 0 'computed'
// CHECK-EXPANDED-NEXT: |-VarDeclScope {{.*}}, [144:21 - 150:3] scope_map.(file).funcWithComputedProperties(i:).computed@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.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]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [147:5 - 149:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [150:6 - 155:8] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [150:31 - 150:36] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [150:36 - 155:8] entry 1 'stored1' 'stored2'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [151:3 - 155:8] entry 2 'alsoComputed'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [151:21 - 155:8] entry 2 'alsoComputed'
// CHECK-EXPANDED-NEXT: |-VarDeclScope {{.*}}, [151:25 - 153:3] scope_map.(file).funcWithComputedProperties(i:).alsoComputed@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.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]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [155:6 - 155:8]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [144:21 - 150:3] entry 0 'computed'
// CHECK-EXPANDED-NEXT: `-VarDeclScope {{.*}}, [144:21 - 150:3] scope_map.(file).funcWithComputedProperties(i:).computed@SOURCE_DIR/test/NameBinding/scope_map.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]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [147:5 - 149:5] '_'
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [147:9 - 149:5]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [147:9 - 149:5]
// 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] scope_map.(file).funcWithComputedProperties(i:).alsoComputed@SOURCE_DIR/test/NameBinding/scope_map.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]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [155:6 - 155:8]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [158:1 - 163:1] 'closures()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [158:14 - 163:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [158:14 - 163:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [158:17 - 163:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [158:17 - 163:1]
// CHECK-EXPANDED-NEXT: |-WholeClosureScope {{.*}}, [159:3 - 161:3]
@@ -427,7 +413,7 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [165:1 - 165:14]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [165:1 - 165:14]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [167:1 - 176:1] 'defaultArguments(i:j:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [167:22 - 176:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [167:22 - 176:1]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [167:32 - 167:32]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [168:32 - 168:48]
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [168:32 - 168:42]
@@ -435,8 +421,8 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [168:32 - 168:42]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [168:51 - 176:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [168:51 - 176:1]
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [170:3 - 172:3] 'localWithDefaults(i:j:)'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [170:25 - 172:3]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [170:3 - 172:3] 'localWithDefaults(i:j:)'
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [170:25 - 172:3]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [170:35 - 170:35]
// CHECK-EXPANDED-NEXT: |-DefaultArgumentInitializerScope {{.*}}, [171:35 - 171:51]
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [171:35 - 171:45]
@@ -444,39 +430,37 @@ class LazyProperties {
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [171:35 - 171:45]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [171:54 - 172:3]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [171:54 - 172:3]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [174:7 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [174:11 - 175:11] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-WholeClosureScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: `-ClosureBodyScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [175:3 - 175:8]
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [178:1 - 181:1] 'PatternInitializers'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [178:28 - 181:1] 'PatternInitializers'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [179:7 - 180:25] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [179:16 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [179:21 - 180:25] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [180:7 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [180:16 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [180:25 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [179:7 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [179:16 - 179:21] entry 0 'a' 'b'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [180:7 - 180:25] entry 1 'c' 'd'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [180:16 - 180:25] entry 1 'c' 'd'
// 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] scope_map.(file).ProtoWithSubscript.subscript(_:)@SOURCE_DIR{{[/\]}}test{{[/\]}}NameBinding{{[/\]}}scope_map.swift:184:3
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [184:12 - 184:43]
// CHECK-EXPANDED-NEXT: `-SubscriptDeclScope {{.*}}, [184:3 - 184:43] scope_map.(file).ProtoWithSubscript.subscript(_:)@SOURCE_DIR/test/NameBinding/scope_map.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] '_'
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [187:1 - 189:1] 'localPatternsWithSharedType()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [187:33 - 189:1]
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [187:33 - 189:1]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [187:36 - 189:1]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [187:36 - 189:1]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:7 - 188:16] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:7 - 188:16] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:10 - 188:16] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:10 - 188:16] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:13 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [188:16 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [188:7 - 188:7] entry 0 'i'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [188:10 - 188:10] entry 1 'j'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [188:13 - 188:16] entry 2 'k'
// CHECK-EXPANDED-NEXT: `-NominalTypeDeclScope {{.*}}, [191:1 - 195:1] 'LazyProperties'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [191:22 - 195:1] 'LazyProperties'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [192:7 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [192:20 - 192:20] entry 0 'value'
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [194:12 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [194:24 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [194:29 - 194:29] entry 0 'prop'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [194:24 - 194:29] entry 0 'prop'
@@ -488,30 +472,31 @@ class LazyProperties {
// CHECK-SEARCHES: ***Scope at 71:8***
// CHECK-SEARCHES-NEXT: BraceStmtScope {{.*}}, [69:53 - 72:3]
// CHECK-SEARCHES-NEXT: Local bindings: c
// CHECK-SEARCHES-NEXT: ***Scope at 27:20***
// CHECK-SEARCHES-NEXT: AbstractFunctionParamsScope {{.*}}, [27:13 - 28:3]
// CHECK-SEARCHES-NEXT: ParameterListScope {{.*}}, [27:13 - 28:3]
// CHECK-SEARCHES-NEXT: ***Scope at 6:18***
// CHECK-SEARCHES-NEXT: NominalTypeBodyScope {{.*}}, [6:17 - 6:19] 'InnerC0'
// CHECK-SEARCHES-NEXT: {{.*}} Module name=scope_map
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.swift"
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map.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=scope_map
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.swift"
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map.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=scope_map
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.swift"
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map.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=scope_map
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map.swift"
// CHECK-SEARCHES-NEXT: {{.*}} FileUnit file="SOURCE_DIR/test/NameBinding/scope_map.swift"
// CHECK-SEARCHES-NEXT: {{.*}} ClassDecl name=LazyProperties
// CHECK-SEARCHES-NEXT: {{.*}} Initializer PatternBinding {{.*}} #0
// CHECK-SEARCHES-NEXT: Local bindings: self

View File

@@ -26,39 +26,36 @@ var i: Int = b.my_identity()
// CHECK-EXPANDED: ***Complete scope map***
// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, [1:1 - 65:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map_top_level.swift'
// CHECK-EXPANDED-NEXT: ASTSourceFileScope {{.*}}, (uncached) [1:1 - 62:1] 'SOURCE_DIR{{[/\\]}}test{{[/\\]}}NameBinding{{[/\\]}}scope_map_top_level.swift'
// CHECK-EXPANDED-NEXT: |-NominalTypeDeclScope {{.*}}, [4:1 - 4:13] 'S0'
// CHECK-EXPANDED-NEXT: `-NominalTypeBodyScope {{.*}}, [4:11 - 4:13] 'S0'
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [6:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [6:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [6:5 - 21:28] entry 0 'a'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [6:15 - 6:15] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [6:15 - 21:28] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [8:7 - 8:22] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [8:22 - 8:22] let b?
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [8:22 - 9:1]
// CHECK-EXPANDED-NEXT: `-GuardStmtUseScope, [9:1 - 21:28]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [11:1 - 11:13] 'foo()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [11:9 - 11:13]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [11:12 - 11:13]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [11:12 - 11:13]
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [13:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [13:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [13:5 - 21:28] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [13:9 - 13:9] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [13:9 - 21:28] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [15:1 - 15:15] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-ExtensionDeclScope {{.*}}, [17:1 - 19:1] 'Int'
// CHECK-EXPANDED-NEXT: `-ExtensionBodyScope {{.*}}, [17:15 - 19:1] 'Int'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [18:3 - 18:43] 'my_identity()'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionParamsScope {{.*}}, [18:19 - 18:43]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [18:29 - 18:43]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [18:29 - 18:43]
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [21:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [21:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [21:5 - 21:28] entry 0 'i'
// CHECK-EXPANDED-NEXT: |-PatternEntryInitializerScope {{.*}}, [21:14 - 21:28] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryUseScope {{.*}}, [21:28 - 21:28] entry 0 'i'
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [6:5 - 6:15] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [6:15 - 6:15] entry 0 'a'
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-GuardStmtScope {{.*}}, [8:1 - 21:28]
// CHECK-EXPANDED-NEXT: |-ConditionalClauseScope, [8:7 - 8:22] index 0
// CHECK-EXPANDED-NEXT: `-ConditionalClausePatternUseScope, [8:22 - 8:22] let b?
// CHECK-EXPANDED-NEXT: |-BraceStmtScope {{.*}}, [8:22 - 9:1]
// CHECK-EXPANDED-NEXT: `-LookupParentDiversionScope, [9:1 - 21:28]
// CHECK-EXPANDED-NEXT: |-AbstractFunctionDeclScope {{.*}}, [11:1 - 11:13] 'foo()'
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [11:9 - 11:13]
// CHECK-EXPANDED-NEXT: `-PureFunctionBodyScope {{.*}}, [11:12 - 11:13]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [11:12 - 11:13]
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [13:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [13:1 - 21:28]
// CHECK-EXPANDED-NEXT: |-PatternEntryDeclScope {{.*}}, [13:5 - 13:9] entry 0 'c'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [13:9 - 13:9] entry 0 'c'
// CHECK-EXPANDED-NEXT: |-TypeAliasDeclScope {{.*}}, [15:1 - 15:15] <no extended nominal?!>
// CHECK-EXPANDED-NEXT: |-ExtensionDeclScope {{.*}}, [17:1 - 19:1] 'Int'
// CHECK-EXPANDED-NEXT: `-ExtensionBodyScope {{.*}}, [17:15 - 19:1] 'Int'
// CHECK-EXPANDED-NEXT: `-AbstractFunctionDeclScope {{.*}}, [18:3 - 18:43] 'my_identity()'
// CHECK-EXPANDED-NEXT: `-ParameterListScope {{.*}}, [18:19 - 18:43]
// CHECK-EXPANDED-NEXT: `-MethodBodyScope {{.*}}, [18:29 - 18:43]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [18:29 - 18:43]
// CHECK-EXPANDED-NEXT: `-TopLevelCodeScope {{.*}}, [21:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-BraceStmtScope {{.*}}, [21:1 - 21:28]
// CHECK-EXPANDED-NEXT: `-PatternEntryDeclScope {{.*}}, [21:5 - 21:28] entry 0 'i'
// CHECK-EXPANDED-NEXT: `-PatternEntryInitializerScope {{.*}}, [21:14 - 21:28] entry 0 'i'

View File

@@ -1,21 +0,0 @@
// REQUIRES: enable-astscope-lookup
// RUN: %target-typecheck-verify-swift
// This used to crash in SILGen (rightly so).
func sr3210_crash() {
defer {
print("\(b)") // expected-error {{use of unresolved identifier 'b'}}
}
return
let b = 2 // expected-warning {{initialization of immutable value 'b' was never used; consider replacing with assignment to '_' or removing it}}
}
func sr3210() {
defer {
print("\(b)") // expected-error {{use of unresolved identifier 'b'}}
}
let b = 2 // expected-warning {{initialization of immutable value 'b' was never used; consider replacing with assignment to '_' or removing it}}
}

View File

@@ -1,4 +1,3 @@
// XFAIL: enable-astscope-lookup
// RUN: %target-typecheck-verify-swift
// SR-5163

View File

@@ -1,100 +0,0 @@
// REQUIRES: enable-astscope-lookup
// RUN: %target-typecheck-verify-swift
func makeIncrementor(amount: Int) -> () -> Int {
func incrementor() -> Int {
currentTotal += amount // expected-error{{use of unresolved identifier 'currentTotal'}}
return currentTotal // expected-error{{use of unresolved identifier 'currentTotal'}}
}
var currentTotal = 0
currentTotal = 1; _ = currentTotal
return incrementor
}
func pingpong() {
func ping() -> Int {
return pong()
}
func pong() -> Int {
return ping()
}
_ = ping()
}
func transitiveForwardCapture() {
func ping() -> Int {
return pong() // expected-error{{cannot capture 'pong', which would use 'x' before it is declared}}
}
_ = ping()
var x = 1 // expected-note{{'x' declared here}}
func pong() -> Int { // expected-note{{'pong', declared here, captures 'x'}}
x += 1
return ping()
}
}
func transitiveForwardCapture2() {
func ping() -> Int {
_ = pong() // expected-error{{cannot capture 'pong', which would use 'x' before it is declared}}
}
_ = ping()
var x = 1 // expected-note{{'x' declared here}}
func pong() -> Int { // expected-note{{'pong', declared here, captures 'pung'}}
_ = pung()
}
func pung() -> Int { // expected-note{{'pung', declared here, captures 'x'}}
x += 1
return ping()
}
}
func transitiveForwardCapture3() {
var y = 2
func ping() -> Int {
_ = pong() // expected-error{{cannot capture 'pong', which would use 'x' before it is declared}}
}
_ = ping()
var x = 1 // expected-note{{'x' declared here}}
func pung() -> Int { // expected-note{{'pung', declared here, captures 'x'}}
x += 1
return ping()
}
func pong() -> Int { // expected-note{{'pong', declared here, captures 'pung'}}
y += 2
_ = pung()
}
}
func outOfOrderEnum() {
func f() -> Suit {
return .Club
}
enum Suit {
case Club
case Diamond
case Heart
case Spade
}
}
func captureInClosure() {
let x = { (i: Int) in
currentTotal += i // expected-error{{use of unresolved identifier 'currentTotal'}}
}
var currentTotal = 0
_ = x
currentTotal += 1
}
class X {
func foo() { }
}
func captureLists(x: X) {
{ [unowned x] in x.foo() }();
let _: Void = { [unowned x] in x.foo() }()
let _: Void = { [weak x] in x?.foo() }()
}

View File

@@ -400,8 +400,11 @@ config.substitutions.append( ('%swift-ide-test', "%r %s %s -swift-version %s" %
config.substitutions.append( ('%swift-syntax-test', config.swift_syntax_test) )
if 'syntax_parser_lib' in config.available_features:
config.substitutions.append( ('%swift-syntax-parser-test', config.swift_syntax_parser_test) )
# For testing on CI
if '-enable-astscope-lookup' in config.swift_test_options:
config.available_features.add("enable-astscope-lookup")
if '-disable-astscope-lookup' in config.swift_test_options:
config.available_features.add("disable-astscope-lookup")
if '-disable-parser-lookup' in config.swift_test_options:
config.available_features.add("disable-parser-lookup")
config.substitutions.append( ('%swift-indent', config.swift_indent) )