Skip to content

Commit c0375db

Browse files
committed
Remove TypeResolutionFlags::KnownNonCascadingDependency
1 parent 3921871 commit c0375db

File tree

4 files changed

+7
-32
lines changed

4 files changed

+7
-32
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,11 +1751,6 @@ UnderlyingTypeRequest::evaluate(Evaluator &evaluator,
17511751
? TypeResolverContext::GenericTypeAliasDecl
17521752
: TypeResolverContext::TypeAliasDecl));
17531753

1754-
if (!typeAlias->getDeclContext()->isCascadingContextForLookup(
1755-
/*functionsAreNonCascading*/ true)) {
1756-
options |= TypeResolutionFlags::KnownNonCascadingDependency;
1757-
}
1758-
17591754
// This can happen when code completion is attempted inside
17601755
// of typealias underlying type e.g. `typealias F = () -> Int#^TOK^#`
17611756
auto *underlyingRepr = typeAlias->getUnderlyingTypeRepr();

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,11 +951,6 @@ Type StructuralTypeRequest::evaluate(Evaluator &evaluator,
951951
? TypeResolverContext::GenericTypeAliasDecl
952952
: TypeResolverContext::TypeAliasDecl));
953953

954-
if (!typeAlias->getDeclContext()->isCascadingContextForLookup(
955-
/*functionsAreNonCascading*/ true)) {
956-
options |= TypeResolutionFlags::KnownNonCascadingDependency;
957-
}
958-
959954
// This can happen when code completion is attempted inside
960955
// of typealias underlying type e.g. `typealias F = () -> Int#^TOK^#`
961956
auto &ctx = typeAlias->getASTContext();

lib/Sema/TypeCheckType.cpp

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,11 +1325,8 @@ static Type resolveTopLevelIdentTypeComponent(TypeResolution resolution,
13251325
}
13261326
}
13271327

1328-
NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
1329-
if (options.contains(TypeResolutionFlags::KnownNonCascadingDependency))
1330-
lookupOptions |= NameLookupFlags::KnownPrivate;
13311328
auto globals = TypeChecker::lookupUnqualifiedType(DC, id, comp->getLoc(),
1332-
lookupOptions);
1329+
defaultUnqualifiedLookupOptions);
13331330

13341331
// Process the names we found.
13351332
Type current;
@@ -1407,7 +1404,7 @@ static Type resolveTopLevelIdentTypeComponent(TypeResolution resolution,
14071404
return ErrorType::get(ctx);
14081405

14091406
return diagnoseUnknownType(resolution, nullptr, SourceRange(), comp,
1410-
lookupOptions);
1407+
defaultUnqualifiedLookupOptions);
14111408
}
14121409

14131410
comp->setValue(currentDecl, currentDC);
@@ -1529,20 +1526,11 @@ static Type resolveNestedIdentTypeComponent(TypeResolution resolution,
15291526
// Phase 1: Find and bind the component decl.
15301527

15311528
// Look for member types with the given name.
1532-
bool isKnownNonCascading = options.contains(TypeResolutionFlags::KnownNonCascadingDependency);
1533-
if (!isKnownNonCascading && options.isAnyExpr()) {
1534-
// Expressions cannot affect a function's signature.
1535-
isKnownNonCascading = isa<AbstractFunctionDecl>(DC);
1536-
}
1537-
1538-
NameLookupOptions lookupOptions = defaultMemberLookupOptions;
1539-
if (isKnownNonCascading)
1540-
lookupOptions |= NameLookupFlags::KnownPrivate;
15411529
LookupTypeResult memberTypes;
15421530
if (parentTy->mayHaveMembers())
15431531
memberTypes = TypeChecker::lookupMemberType(DC, parentTy,
15441532
comp->getNameRef(),
1545-
lookupOptions);
1533+
defaultMemberLookupOptions);
15461534

15471535
// Name lookup was ambiguous. Complain.
15481536
// FIXME: Could try to apply generic arguments first, and see whether
@@ -1565,7 +1553,7 @@ static Type resolveNestedIdentTypeComponent(TypeResolution resolution,
15651553
return ErrorType::get(ctx);
15661554

15671555
memberType = diagnoseUnknownType(resolution, parentTy, parentRange, comp,
1568-
lookupOptions);
1556+
defaultMemberLookupOptions);
15691557
member = comp->getBoundDecl();
15701558
if (!member)
15711559
return ErrorType::get(ctx);

lib/Sema/TypeCheckType.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,14 @@ enum class TypeResolutionFlags : uint16_t {
5555
/// Whether this is a resolution based on a non-inferred type pattern.
5656
FromNonInferredPattern = 1 << 6,
5757

58-
/// Whether this type resolution is guaranteed not to affect downstream files.
59-
KnownNonCascadingDependency = 1 << 7,
60-
6158
/// Whether we are at the direct base of a type expression.
62-
Direct = 1 << 8,
59+
Direct = 1 << 7,
6360

6461
/// Whether we should not produce diagnostics if the type is invalid.
65-
SilenceErrors = 1 << 9,
62+
SilenceErrors = 1 << 8,
6663

6764
/// Whether to allow module declaration types.
68-
AllowModule = 1 << 10
65+
AllowModule = 1 << 9,
6966
};
7067

7168
/// Type resolution contexts that require special handling.

0 commit comments

Comments
 (0)