@@ -486,13 +486,13 @@ final class testNameLookup: XCTestCase {
486
486
487
487
9️⃣class d {}
488
488
489
- let x = 0️⃣d
489
+ let 🔟a = 0️⃣d
490
490
""" ,
491
491
references: [
492
492
" 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " ] ) ] ,
493
493
" 4️⃣ " : [ . fromFileScope( expectedNames: [ " 2️⃣ " ] ) ] ,
494
494
" 5️⃣ " : [ . fromFileScope( expectedNames: [ " 7️⃣ " ] ) ] ,
495
- " 6️⃣ " : [ ] ,
495
+ " 6️⃣ " : [ . fromFileScope ( expectedNames : [ " 9️⃣ " ] ) ] ,
496
496
" 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
497
497
] ,
498
498
expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] )
@@ -516,16 +516,19 @@ final class testNameLookup: XCTestCase {
516
516
517
517
9️⃣class d {}
518
518
519
- let x = 0️⃣d
519
+ let 🔟a = 0️⃣d
520
520
""" ,
521
521
references: [
522
- " 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " ] ) ] ,
522
+ " 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " , " 🔟 " ] ) ] ,
523
523
" 4️⃣ " : [ . fromFileScope( expectedNames: [ " 2️⃣ " ] ) ] ,
524
524
" 5️⃣ " : [ . fromFileScope( expectedNames: [ " 7️⃣ " ] ) ] ,
525
525
" 6️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
526
526
" 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
527
527
] ,
528
- expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] ) ,
528
+ expectedResultTypes: . all( ClassDeclSyntax . self, except: [
529
+ " 8️⃣ " : IdentifierPatternSyntax . self,
530
+ " 🔟 " : IdentifierPatternSyntax . self
531
+ ] ) ,
529
532
config: LookupConfig ( fileScopeHandling: . memberBlock)
530
533
)
531
534
}
@@ -547,17 +550,35 @@ final class testNameLookup: XCTestCase {
547
550
548
551
9️⃣class d {}
549
552
550
- let x = 0️⃣d
553
+ let 🔟a = 0️⃣d
551
554
""" ,
552
555
references: [
553
556
" 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " ] ) ] ,
554
- " 4️⃣ " : [ ] ,
555
- " 5️⃣ " : [ ] ,
556
- " 6️⃣ " : [ ] ,
557
+ " 4️⃣ " : [ . fromFileScope ( expectedNames : [ " 2️⃣ " ] ) ] ,
558
+ " 5️⃣ " : [ . fromFileScope ( expectedNames : [ " 7️⃣ " ] ) ] ,
559
+ " 6️⃣ " : [ . fromFileScope ( expectedNames : [ " 9️⃣ " ] ) ] ,
557
560
" 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
558
561
] ,
559
562
expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] ) ,
560
563
config: LookupConfig ( fileScopeHandling: . codeBlock)
561
564
)
562
565
}
566
+
567
+ func testDeclarationAvailabilityInCodeBlock( ) {
568
+ assertLexicalNameLookup (
569
+ source: """
570
+ func x {
571
+ 1️⃣class A {}
572
+
573
+ let a = 2️⃣A()
574
+
575
+ 3️⃣class A {}
576
+ }
577
+ """ ,
578
+ references: [
579
+ " 2️⃣ " : [ . fromScope( CodeBlockSyntax . self, expectedNames: [ " 1️⃣ " , " 3️⃣ " ] ) ]
580
+ ] ,
581
+ expectedResultTypes: . all( ClassDeclSyntax . self)
582
+ )
583
+ }
563
584
}
0 commit comments