Skip to content

Commit db44a8e

Browse files
authored
Merge pull request #32132 from slavapestov/a-couple-of-regression-tests
A couple of regression tests
2 parents 32e1d22 + 4f87899 commit db44a8e

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// RUN: %target-swift-frontend -typecheck -verify %s
2+
3+
protocol A {
4+
associatedtype BType: B where BType.AType == Self
5+
associatedtype CType: C where CType.AType == Self
6+
7+
var b: BType { get }
8+
var c: CType { get set }
9+
10+
func bGetter() -> BType
11+
mutating func cSetter(_ newC: CType)
12+
13+
subscript (b: BType) -> CType { get set }
14+
}
15+
16+
protocol B {
17+
associatedtype AType: A
18+
}
19+
20+
protocol C {
21+
associatedtype AType: A
22+
}
23+
24+
struct AImpl: A {
25+
typealias BType = BImpl
26+
typealias CType = CImpl
27+
28+
let b: BImpl
29+
var c: CImpl
30+
31+
func bGetter() -> BImpl {
32+
return b
33+
}
34+
35+
mutating func cSetter(_ newC: CImpl) {
36+
c = newC
37+
}
38+
39+
subscript(b: BImpl) -> CImpl {
40+
get {
41+
return c
42+
}
43+
set {
44+
c = newValue
45+
}
46+
}
47+
}
48+
49+
struct BImpl: B {
50+
typealias AType = AImpl
51+
}
52+
53+
struct CImpl: C {
54+
typealias AType = AImpl
55+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
struct Foo: OptionSet {
4+
let rawValue: Int
5+
static let none = Foo(rawValue: 1 << 0)
6+
}
7+
8+
extension Foo: ExpressibleByIntegerLiteral { }

0 commit comments

Comments
 (0)