Skip to content

Commit 236d22c

Browse files
committed
Add regression test for bug already fixed
1 parent a2a2083 commit 236d22c

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol RequiresIntFunction {
4+
associatedtype A = ()
5+
func intFunction(_ x: Int, _ a: A) -> Bool
6+
}
7+
8+
struct Regular<A>: RequiresIntFunction {
9+
func intFunction(_ x: Int, _ a: A) -> Bool {
10+
true
11+
}
12+
}
13+
14+
struct GenericBad<A>: RequiresIntFunction {
15+
func intFunction(_ x: some FixedWidthInteger, _ a: A) -> Bool {
16+
true
17+
}
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %target-swift-frontend -emit-silgen %s -disable-experimental-associated-type-inference
2+
// RUN: %target-swift-frontend -emit-silgen %s -enable-experimental-associated-type-inference
3+
4+
public struct G<A, B, C>: P {
5+
public typealias D = G<A, C, B>
6+
public typealias E = G<A, S, C>
7+
public typealias F = G<A, B, S>
8+
}
9+
10+
public struct S {}
11+
12+
public protocol P {
13+
associatedtype A
14+
associatedtype B
15+
associatedtype C
16+
associatedtype D: P where D.A == A, D.D == Self
17+
associatedtype E: P where E.C == C, E.B == S, E.A == A, E.E == E
18+
associatedtype F: P where F.C == S, F.B == B, F.A == A, F.F == F
19+
}

0 commit comments

Comments
 (0)