Skip to content

Commit 98e6c7b

Browse files
committed
ConformanceLookup: filter ReferenceStorageType
There's a few uses of ReferenceStorageTypes being substituted for generic parameters, at least in the test suite, such as `Optional<@sil_unmanaged ..>` and just plain `<@sil_unowned ..>`. Before, conformance lookup could (and did) give bogus answers when asked if the type satisfies any conformance requirements. Now with NoncopyableGenerics, we will interpret such conformance lookups as being asked of the referent type, ignoring the SIL ownership wrapping it.
1 parent 4903b67 commit 98e6c7b

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lib/AST/ConformanceLookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ LookupConformanceInModuleRequest::evaluate(
472472
auto *protocol = desc.PD;
473473
ASTContext &ctx = mod->getASTContext();
474474

475+
// Remove SIL reference ownership wrapper, if present.
476+
type = type->getReferenceStorageReferent();
477+
475478
// A dynamic Self type conforms to whatever its underlying type
476479
// conforms to.
477480
if (auto selfType = type->getAs<DynamicSelfType>())

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,14 +1083,6 @@ Type TypeResolution::applyUnboundGenericArguments(
10831083
if (didDiagnoseMoveOnlyGenericArgs(ctx, loc, resultType, genericArgs, dc))
10841084
return ErrorType::get(ctx);
10851085

1086-
if (options.contains(TypeResolutionFlags::SILType)) {
1087-
if (auto nominal = dyn_cast<NominalTypeDecl>(decl)) {
1088-
if (nominal->isOptionalDecl()) {
1089-
skipRequirementsCheck = true;
1090-
}
1091-
}
1092-
}
1093-
10941086
// Get the substitutions for outer generic parameters from the parent
10951087
// type.
10961088
if (parentTy) {

0 commit comments

Comments
 (0)