Skip to content

Commit 3ec584e

Browse files
committed
[Test] NFC: Add test-case for recursive protocol deserialization (rdar://100127674)
1 parent bf599b7 commit 3ec584e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %empty-directory(%t/src)
2+
// RUN: split-file %s %t/src
3+
4+
/// Build the library A
5+
// RUN: %target-swift-frontend -emit-module %t/src/API.swift \
6+
// RUN: -module-name API -swift-version 5 \
7+
// RUN: -emit-module-path %t/API.swiftmodule
8+
9+
// Build client with module
10+
// RUN: %target-swift-emit-silgen \
11+
// RUN: -I %t \
12+
// RUN: -module-name Client \
13+
// RUN: %t/src/Client.swift -verify
14+
15+
//--- API.swift
16+
17+
public class C {}
18+
19+
public protocol P1 {
20+
typealias A = (C & P1)
21+
}
22+
23+
public protocol P2 {
24+
typealias F = (P2) -> Void
25+
}
26+
27+
public protocol P3 where Self : C {
28+
}
29+
30+
//--- Client.swift
31+
import API
32+
33+
func test(_: any P1) {} // Ok
34+
35+
_ = P2.self // Ok
36+
37+
class B : P3 {
38+
// expected-error@-1 {{type 'B' does not conform to protocol 'P3'}}
39+
// expected-error@-2 {{'P3' requires that 'B' inherit from 'C'}}
40+
// expected-note@-3 {{requirement specified as 'Self' : 'C' [with Self = B]}}
41+
}

0 commit comments

Comments
 (0)