Skip to content

Commit 9edb00e

Browse files
authored
Merge pull request #58817 from CodaFi/para-parallels
[5.7] Teach Type Deserialization About Parameterized Protocol Types
2 parents afa1e28 + c70ec06 commit 9edb00e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6354,6 +6354,7 @@ Expected<Type> TypeDeserializer::getTypeCheckedImpl() {
63546354
CASE(SequenceArchetype)
63556355
CASE(GenericTypeParam)
63566356
CASE(ProtocolComposition)
6357+
CASE(ParameterizedProtocol)
63576358
CASE(Existential)
63586359
CASE(DependentMember)
63596360
CASE(BoundGeneric)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
public protocol MySequence<Element> {
22
associatedtype Element
33
}
4+
5+
public struct MySequenceHolder<Element> {
6+
public var seq: any MySequence<Element>
7+
8+
public init(seq: any MySequence<Element>) {
9+
self.seq = seq
10+
}
11+
}
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -emit-module %S/Inputs/parameterized_protocol_other.swift -emit-module-path %t/parameterized_protocol_other.swiftmodule
3-
// RUN: %target-typecheck-verify-swift -I%t
2+
// RUN: %target-swift-frontend -enable-parameterized-existential-types -emit-module %S/Inputs/parameterized_protocol_other.swift -emit-module-path %t/parameterized_protocol_other.swiftmodule
3+
// RUN: %target-typecheck-verify-swift -enable-parameterized-existential-types -I%t
44

55
import parameterized_protocol_other
66

77
func testParameterizedProtocol(_: some MySequence<Int>) {}
8+
func testParameterizedProtocol(x : any MySequence<Int>) -> MySequenceHolder<Int> {
9+
return MySequenceHolder(seq: x)
10+
}

0 commit comments

Comments
 (0)