Skip to content

Commit 326e564

Browse files
authored
Merge pull request #19827 from DougGregor/rdar39805133
2 parents a9315e9 + 1fc57ad commit 326e564

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
protocol DefaultInit { init() }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %target-swift-frontend -emit-ir -o - -primary-file %s %S/Inputs/protocol-conformance-rdar39805133-other.swift -module-name foo
2+
// RUN: %target-swift-frontend -emit-ir -o - %s -primary-file %S/Inputs/protocol-conformance-rdar39805133-other.swift -module-name foo
3+
4+
protocol _Int : DefaultInit {
5+
associatedtype Minus1 : _Int
6+
associatedtype Plus1 : _Int = Inc<Self>
7+
static var value: Int { get }
8+
}
9+
10+
struct Inc<T : _Int> : _Int {
11+
typealias Minus1 = T
12+
static var value: Int { return T.value + 1 }
13+
}
14+
15+
extension _Int {
16+
var plus1: Plus1 { return Plus1() }
17+
var minus1: Minus1 { return Minus1() }
18+
}
19+
20+
struct _0_ : _Int {
21+
typealias Minus1 = _0_//Underflow
22+
static let value = 0
23+
}
24+
25+
let _0 = _0_()
26+
protocol AtLeast0 : _Int {}
27+
extension _0_ : AtLeast0 {}
28+
protocol AtLeast1 : AtLeast0 {}
29+
extension Inc : AtLeast1, AtLeast0 where T == _0_ {}

0 commit comments

Comments
 (0)