Skip to content

Commit bdd6bfd

Browse files
committed
[test] Test covariant erasure for constrained existentials
1 parent 38a6726 commit bdd6bfd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/type/parameterized_existential.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,14 @@ func protocolCompositionNotSupported1(_: SomeProto & Sequence<Int>) {}
9292
func protocolCompositionNotSupported2(_: any SomeProto & Sequence<Int>) {}
9393
// expected-error@-1 {{non-protocol, non-class type 'Sequence<Int>' cannot be used within a protocol-constrained type}}
9494

95-
func increment(n : any Sequence<Float>) {
95+
func increment(_ n : any Collection<Float>) {
9696
for value in n {
9797
_ = value + 1
9898
}
9999
}
100+
101+
func genericIncrement<T: Numeric>(_ n : any Collection<T>) {
102+
for value in n {
103+
_ = value + 1
104+
}
105+
}

0 commit comments

Comments
 (0)