File tree Expand file tree Collapse file tree 2 files changed +67
-0
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir %s
2
+
3
+ protocol Dismissable {
4
+ func dismiss( completion: @escaping ( ) -> Void )
5
+ }
6
+
7
+ typealias Completion = ( Dismissable ? ) -> Void
8
+
9
+ protocol Cancelable : AnyObject {
10
+ func cancel( )
11
+ }
12
+
13
+ protocol Controller {
14
+ func asyncThing( completion: @escaping ( ( _ error: Error ) -> Void ) ) -> Cancelable
15
+ }
16
+
17
+ public struct Message : Equatable {
18
+ public static let `default` = Message ( )
19
+
20
+ public init ( ) {
21
+ }
22
+
23
+ public init ( error: Error ) {
24
+ self = . default
25
+ }
26
+ }
27
+
28
+ struct PresentAlert {
29
+ let message : Message
30
+ }
31
+
32
+ class Manager {
33
+ private let controller : Controller
34
+
35
+ init ( controller: Controller ) {
36
+ self . controller = controller
37
+ }
38
+
39
+ func present( ) {
40
+ let _: Completion = { ( dismissable: Dismissable ? ) in
41
+ dismissable? . dismiss { [ weak self] in
42
+ guard let sself = self else { return }
43
+
44
+ sself. controller. asyncThing { error in
45
+ let backupMessage = Message ( )
46
+ let mainMessage = Message ( error: error)
47
+ let finalMessage = mainMessage != Message . default ? mainMessage : backupMessage
48
+
49
+ _ = PresentAlert ( message: finalMessage)
50
+ } . cancel ( )
51
+ }
52
+ }
53
+ }
54
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir %s
2
+
3
+ protocol Projection {
4
+ associatedtype Root
5
+ associatedtype Path : PartialKeyPath < Root >
6
+ static var path : Path { get }
7
+ }
8
+
9
+ struct ProjectKey < Key, Value> : Projection {
10
+ typealias Root = ( Key , Value )
11
+ typealias Path = KeyPath < ( Key , Value ) , Key >
12
+ static var path : KeyPath < ( Key , Value ) , Key > { \. 0 }
13
+ }
You can’t perform that action at this time.
0 commit comments