Skip to content

Commit f6f53f6

Browse files
committed
[Codable] When explicit existential types are enabled, synthesize Codable
initializer requirements with explicit existential Encodable and Decodable parameters.
1 parent a7fa469 commit f6f53f6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: lib/Sema/DerivedConformanceCodable.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,9 @@ static FuncDecl *deriveEncodable_encode(DerivedConformance &derived) {
12121212
// Create from the inside out:
12131213

12141214
auto encoderType = C.getEncoderType();
1215+
if (C.LangOpts.EnableExplicitExistentialTypes)
1216+
encoderType = ExistentialType::get(encoderType);
1217+
12151218
auto returnType = TupleType::getEmpty(C);
12161219

12171220
// Params: (Encoder)
@@ -1803,6 +1806,9 @@ static ValueDecl *deriveDecodable_init(DerivedConformance &derived) {
18031806

18041807
// Params: (Decoder)
18051808
auto decoderType = C.getDecoderType();
1809+
if (C.LangOpts.EnableExplicitExistentialTypes)
1810+
decoderType = ExistentialType::get(decoderType);
1811+
18061812
auto *decoderParamDecl = new (C) ParamDecl(
18071813
SourceLoc(), SourceLoc(), C.Id_from,
18081814
SourceLoc(), C.Id_decoder, conformanceDC);

0 commit comments

Comments
 (0)