File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+
1
2
// RUN: %target-typecheck-verify-swift -swift-version 5 -enable-experimental-static-assert
2
3
3
4
func isInt< T> ( _ value: T ) -> Bool {
@@ -380,6 +381,37 @@ func test_diagnosing_on_missing_member_in_case() {
380
381
}
381
382
}
382
383
384
+ // rdar://92757114 - fallback diagnostic when member doesn't exist in a nested closure
385
+ func test_diagnose_missing_member_in_inner_closure( ) {
386
+ struct B {
387
+ static var member : any StringProtocol = " "
388
+ }
389
+
390
+ struct Cont < T, E: Error > {
391
+ func resume( returning value: T ) { }
392
+ }
393
+
394
+ func withCont< T> ( function: String = #function,
395
+ _ body: ( Cont < T , Never > ) -> Void ) -> T {
396
+ fatalError ( )
397
+ }
398
+
399
+ func test( vals: [ Int ] ? ) -> [ Int ] {
400
+ withCont { continuation in
401
+ guard let vals = vals else {
402
+ return continuation. resume ( returning: [ ] )
403
+ }
404
+
405
+ B . member. get ( 0 , // expected-error {{value of type 'any StringProtocol' has no member 'get'}}
406
+ type: " type " ,
407
+ withinSecs: Int ( 60 * 60 ) ) { arr in
408
+ let result = arr. compactMap { $0 }
409
+ return continuation. resume ( returning: result)
410
+ }
411
+ }
412
+ }
413
+ }
414
+
383
415
// Type finder shouldn't bring external closure result type
384
416
// into the scope of an inner closure e.g. while solving
385
417
// init of pattern binding `x`.
You can’t perform that action at this time.
0 commit comments