@@ -486,13 +486,13 @@ final class testNameLookup: XCTestCase {
486486
487487 9️⃣class d {}
488488
489- let x = 0️⃣d
489+ let 🔟a = 0️⃣d
490490 """ ,
491491 references: [
492492 " 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " ] ) ] ,
493493 " 4️⃣ " : [ . fromFileScope( expectedNames: [ " 2️⃣ " ] ) ] ,
494494 " 5️⃣ " : [ . fromFileScope( expectedNames: [ " 7️⃣ " ] ) ] ,
495- " 6️⃣ " : [ ] ,
495+ " 6️⃣ " : [ . fromFileScope ( expectedNames : [ " 9️⃣ " ] ) ] ,
496496 " 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
497497 ] ,
498498 expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] )
@@ -516,16 +516,19 @@ final class testNameLookup: XCTestCase {
516516
517517 9️⃣class d {}
518518
519- let x = 0️⃣d
519+ let 🔟a = 0️⃣d
520520 """ ,
521521 references: [
522- " 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " ] ) ] ,
522+ " 3️⃣ " : [ . fromFileScope( expectedNames: [ " 1️⃣ " , " 8️⃣ " , " 🔟 " ] ) ] ,
523523 " 4️⃣ " : [ . fromFileScope( expectedNames: [ " 2️⃣ " ] ) ] ,
524524 " 5️⃣ " : [ . fromFileScope( expectedNames: [ " 7️⃣ " ] ) ] ,
525525 " 6️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
526526 " 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
527527 ] ,
528- expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] ) ,
528+ expectedResultTypes: . all( ClassDeclSyntax . self, except: [
529+ " 8️⃣ " : IdentifierPatternSyntax . self,
530+ " 🔟 " : IdentifierPatternSyntax . self
531+ ] ) ,
529532 config: LookupConfig ( fileScopeHandling: . memberBlock)
530533 )
531534 }
@@ -547,17 +550,35 @@ final class testNameLookup: XCTestCase {
547550
548551 9️⃣class d {}
549552
550- let x = 0️⃣d
553+ let 🔟a = 0️⃣d
551554 """ ,
552555 references: [
553556 " 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️⃣ " ] ) ] ,
557560 " 0️⃣ " : [ . fromFileScope( expectedNames: [ " 9️⃣ " ] ) ] ,
558561 ] ,
559562 expectedResultTypes: . all( ClassDeclSyntax . self, except: [ " 8️⃣ " : IdentifierPatternSyntax . self] ) ,
560563 config: LookupConfig ( fileScopeHandling: . codeBlock)
561564 )
562565 }
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+ }
563584}
0 commit comments