Skip to content

Commit 0943351

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 1d7d282 commit 0943351

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
@@ -7478,11 +7478,11 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
74787478
if (!paramDecl)
74797479
continue;
74807480

7481-
auto descriptor = UnqualifiedLookupDescriptor(
7481+
auto descriptor = UnqualifiedLookupDescriptor{
74827482
DeclNameRef(param->getName()),
7483-
paramDecl->getDeclContext()->getParentSourceFile(),
7483+
paramDecl->getDeclContext()->getModuleScopeContext(),
74847484
SourceLoc(),
7485-
UnqualifiedLookupFlags::TypeLookup);
7485+
UnqualifiedLookupFlags::TypeLookup};
74867486
auto lookup = evaluateOrDefault(
74877487
Context.evaluator, UnqualifiedLookupRequest{descriptor}, {});
74887488
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)