File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir %s
2
+
3
+ public protocol SomeProto {
4
+ associatedtype ThingType
5
+ func getThing( ) -> ThingType
6
+ }
7
+
8
+ public protocol SpecialThing : RandomAccessCollection {
9
+ }
10
+
11
+ public protocol Castable {
12
+ associatedtype Source
13
+ static func cast( from: Source ) -> Self
14
+ }
15
+
16
+ public struct ThingGetter < P: SomeProto , T> {
17
+ public let thing : P
18
+ }
19
+
20
+ extension ThingGetter where P. ThingType: SpecialThing , T: Castable , P. ThingType. Iterator. Element == T . Source {
21
+
22
+ public func getView( ) -> ThingView {
23
+ return ThingView ( thing: thing. getThing ( ) )
24
+ }
25
+
26
+ public struct ThingView : SpecialThing {
27
+ let thing : P . ThingType
28
+
29
+ public typealias Index = P . ThingType . Index
30
+ public var startIndex : Index { return thing. startIndex }
31
+ public var endIndex : Index { return thing. startIndex }
32
+ public var count : Int { return thing. count }
33
+ public func index( after i: Index ) -> Index {
34
+ return thing. index ( after: i)
35
+ }
36
+ public func index( before i: Index ) -> Index {
37
+ return thing. index ( before: i)
38
+ }
39
+ public subscript( i: Index ) -> T {
40
+ return T . cast ( from: thing [ i] )
41
+ }
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments