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
This commit is contained in:
Robert Widmann
2021-01-20 15:42:28 -08:00
parent 1d7d282065
commit 0943351fe7
2 changed files with 11 additions and 3 deletions

View File

@@ -7478,11 +7478,11 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
if (!paramDecl)
continue;
auto descriptor = UnqualifiedLookupDescriptor(
auto descriptor = UnqualifiedLookupDescriptor{
DeclNameRef(param->getName()),
paramDecl->getDeclContext()->getParentSourceFile(),
paramDecl->getDeclContext()->getModuleScopeContext(),
SourceLoc(),
UnqualifiedLookupFlags::TypeLookup);
UnqualifiedLookupFlags::TypeLookup};
auto lookup = evaluateOrDefault(
Context.evaluator, UnqualifiedLookupRequest{descriptor}, {});
for (auto &result : lookup) {

View File

@@ -0,0 +1,8 @@
// RUN: not %target-swift-frontend -typecheck %s
typealias IndexResult = Result<Bol, Error>
extension IndexResult {
func perfect() -> Self {
Success(true)
}
}