Skip to content

Commit 60e573a

Browse files
authored
Merge pull request #62760 from DougGregor/remove-wrong-unnecessary-astscope-assertion
[ASTScope] Remove a now-incorrect and not-actually-useful assertion.
2 parents 71c62c0 + d3540e6 commit 60e573a

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

lib/AST/UnqualifiedLookup.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ namespace {
100100
ModuleDecl &M;
101101
const ASTContext &Ctx;
102102
const SourceLoc Loc;
103-
const SourceManager &SM;
104-
103+
105104
/// Used to find the file-local names.
106105
DebuggerClient *const DebugClient;
107106

@@ -152,8 +151,6 @@ namespace {
152151

153152
#pragma mark context-based lookup declarations
154153

155-
bool isInsideBodyOfFunction(const AbstractFunctionDecl *const AFD) const;
156-
157154
/// For diagnostic purposes, move aside the unavailables, and put
158155
/// them back as a last-ditch effort.
159156
/// Could be cleaner someday with a richer interface to UnqualifiedLookup.
@@ -260,7 +257,6 @@ UnqualifiedLookupFactory::UnqualifiedLookupFactory(
260257
M(*DC->getParentModule()),
261258
Ctx(M.getASTContext()),
262259
Loc(Loc),
263-
SM(Ctx.SourceMgr),
264260
DebugClient(M.getDebugClient()),
265261
options(options),
266262
isOriginallyTypeLookup(options.contains(Flags::TypeLookup)),
@@ -328,13 +324,6 @@ void UnqualifiedLookupFactory::lookUpTopLevelNamesInModuleScopeContext(
328324

329325
#pragma mark context-based lookup definitions
330326

331-
bool UnqualifiedLookupFactory::isInsideBodyOfFunction(
332-
const AbstractFunctionDecl *const AFD) const {
333-
auto range = Lexer::getCharSourceRangeFromSourceRange(
334-
SM, AFD->getBodySourceRange());
335-
return range.contains(Loc);
336-
}
337-
338327
void UnqualifiedLookupFactory::ResultFinderForTypeContext::findResults(
339328
const DeclNameRef &Name, NLOptions baseNLOptions,
340329
const DeclContext *contextForLookup,
@@ -794,12 +783,6 @@ bool ASTScopeDeclGatherer::consume(ArrayRef<ValueDecl *> valuesArg,
794783
// TODO: in future, migrate this functionality into ASTScopes
795784
bool ASTScopeDeclConsumerForUnqualifiedLookup::lookInMembers(
796785
const DeclContext *scopeDC) const {
797-
if (candidateSelfDC) {
798-
if (auto *afd = dyn_cast<AbstractFunctionDecl>(candidateSelfDC)) {
799-
assert(factory.isInsideBodyOfFunction(afd) && "Should be inside");
800-
}
801-
}
802-
803786
// We're looking for members of a type.
804787
//
805788
// If we started the looking from inside a scope where a 'self' parameter

test/Macros/macro_expand.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ func testStringify(a: Int, b: Int) {
4545
_ = (b, b2, s2, s3)
4646
}
4747

48+
struct Outer {
49+
var value: Int = 0
50+
func test() {
51+
_ = #stringify(1 + value)
52+
}
53+
}
54+
4855
// CHECK: (2, "a + b")
4956
testStringify(a: 1, b: 1)
5057

0 commit comments

Comments
 (0)