Sema: Relax enum parameter pack restriction for CodingKeys

This commit is contained in:
Slava Pestov
2025-06-13 13:23:02 -04:00
parent 84997b47ef
commit 9a101ca8f6
2 changed files with 14 additions and 5 deletions

View File

@@ -3226,11 +3226,13 @@ public:
// Temporary restriction until we figure out pattern matching and // Temporary restriction until we figure out pattern matching and
// enum case construction with packs. // enum case construction with packs.
if (auto genericSig = ED->getGenericSignature()) { if (!ED->isSynthesized()) {
for (auto paramTy : genericSig.getGenericParams()) { if (auto genericSig = ED->getGenericSignature()) {
if (paramTy->isParameterPack()) { for (auto paramTy : genericSig.getGenericParams()) {
ED->diagnose(diag::enum_with_pack); if (paramTy->isParameterPack()) {
break; ED->diagnose(diag::enum_with_pack);
break;
}
} }
} }
} }

View File

@@ -0,0 +1,7 @@
// RUN: %target-typecheck-verify-swift -target %target-swift-5.9-abi-triple
// We should accept this:
public struct HasPack<each T>: Codable {
var x: String?
}