Skip to content

Commit 5350b96

Browse files
committed
Use the Correct DeclContext When Simplifying Member Constraints
Looking for the parent source file is going to fail when the paramter we're interested in comes from a module context. Request the correct top-level context in those situations. rdar://73379770
1 parent d864e95 commit 5350b96

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7472,11 +7472,11 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
74727472
if (!paramDecl)
74737473
continue;
74747474

7475-
auto descriptor = UnqualifiedLookupDescriptor(
7475+
auto descriptor = UnqualifiedLookupDescriptor{
74767476
DeclNameRef(param->getName()),
7477-
paramDecl->getDeclContext()->getParentSourceFile(),
7477+
paramDecl->getDeclContext()->getModuleScopeContext(),
74787478
SourceLoc(),
7479-
UnqualifiedLookupFlags::TypeLookup);
7479+
UnqualifiedLookupFlags::TypeLookup};
74807480
auto lookup = evaluateOrDefault(
74817481
Context.evaluator, UnqualifiedLookupRequest{descriptor}, {});
74827482
for (auto &result : lookup) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
typealias IndexResult = Result<Bol, Error>
4+
extension IndexResult {
5+
func perfect() -> Self {
6+
Success(true)
7+
}
8+
}

0 commit comments

Comments
 (0)