File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -572,3 +572,32 @@ func foo2() {
572
572
let x = 5
573
573
if x < 0 , let x = Optional ( 1 ) { } // expected-warning {{immutable value 'x' was never used; consider replacing with '_' or removing it}}
574
574
}
575
+
576
+ struct Person {
577
+ let name : String ?
578
+ }
579
+
580
+ struct Company { // expected-note 2{{did you mean 'Company'?}}
581
+ let owner : Person ?
582
+ }
583
+
584
+ func test1( ) {
585
+ let example : Company ? = Company ( owner: Person ( name: " Owner " ) )
586
+ if let person = aCompany. owner, // expected-error {{use of unresolved identifier 'aCompany'}}
587
+ let aCompany = example {
588
+ _ = person
589
+ }
590
+ }
591
+
592
+ func test2( ) {
593
+ let example : Company ? = Company ( owner: Person ( name: " Owner " ) )
594
+ guard let person = aCompany. owner, // expected-error {{use of unresolved identifier 'aCompany'}}
595
+ let aCompany = example else { return }
596
+ }
597
+
598
+ func test3( ) {
599
+ var c : String ? = " c " // expected-note {{did you mean 'c'?}}
600
+ if let a = b = c, let b = c { // expected-error {{use of unresolved identifier 'b'}}
601
+ _ = b
602
+ }
603
+ }
You can’t perform that action at this time.
0 commit comments