Skip to content

Commit fc1ab88

Browse files
committed
In protocol decl scope, whitelist member block instead of filtering lookup position from inheritance clause.
1 parent baf6a2f commit fc1ab88

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Sources/SwiftLexicalLookup/Scopes/ScopeImplementations.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,7 @@ import SwiftSyntax
671671
)
672672
}
673673

674-
let lookInMembers: [LookupResult] =
675-
inheritanceClause?.range.contains(lookUpPosition) ?? false ? [] : [.lookInMembers(self)]
674+
let lookInMembers: [LookupResult] = memberBlock.range.contains(lookUpPosition) ? [.lookInMembers(self)] : []
676675

677676
return results
678677
+ defaultLookupImplementation(

Tests/SwiftLexicalLookupTest/NameLookupTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,12 +1007,10 @@ final class testNameLookup: XCTestCase {
10071007
references: [
10081008
"1️⃣": [
10091009
.fromScope(MemberBlockSyntax.self, expectedNames: ["3️⃣"]),
1010-
.lookInMembers(ProtocolDeclSyntax.self),
10111010
.fromFileScope(expectedNames: ["0️⃣"]),
10121011
],
10131012
"2️⃣": [
1014-
.fromScope(MemberBlockSyntax.self, expectedNames: ["4️⃣"]),
1015-
.lookInMembers(ProtocolDeclSyntax.self),
1013+
.fromScope(MemberBlockSyntax.self, expectedNames: ["4️⃣"])
10161014
],
10171015
],
10181016
expectedResultTypes: .all(

0 commit comments

Comments
 (0)