Skip to content

Commit 4b2fecf

Browse files
authored
Merge pull request #32611 from slavapestov/codable-iuo-assert
Sema: Fix assertion when synthesizing Codable with an IUO stored property
2 parents 6fcfbaa + 422fd41 commit 4b2fecf

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/Sema/DerivedConformanceCodable.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,8 @@ static CodableConformanceType typeConformsToCodable(DeclContext *context,
8282
ProtocolDecl *proto) {
8383
target = context->mapTypeIntoContext(target);
8484

85-
if (isIUO) {
86-
return typeConformsToCodable(context,
87-
target->lookThroughSingleOptionalType(),
88-
false, proto);
89-
}
85+
if (isIUO)
86+
target = target->lookThroughSingleOptionalType();
9087

9188
auto conf = TypeChecker::conformsToProtocol(target, proto, context);
9289
return conf.isInvalid() ? DoesNotConform : Conforms;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %target-typecheck-verify-swift %s
2+
3+
public struct S<T : Codable> : Codable {
4+
var s: [T]!
5+
}

0 commit comments

Comments
 (0)