Skip to content

Commit eb7b307

Browse files
committed
don’t enforce a single scope for ObjC or Clang-imported symbols
1 parent 7369b86 commit eb7b307

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Sources/SymbolGraphCompiler/Declarations/SSGC.DeclObject.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,27 @@ extension SSGC.DeclObject
9292
}
9393

9494
// Only (Objective) C declarations can have multiple lexical scopes.
95+
// https://github.com/swiftlang/swift/blob/main/docs/ABI/Mangling.rst
9596
switch self.scopes.first
9697
{
9798
case scope?:
9899
break
99100

100101
case let existing?:
101-
if case .s = self.id.language
102+
guard case .s = self.id.language
103+
else
102104
{
103-
throw SSGC.LexicalScopeError.multiple(existing, scope)
105+
fallthrough
104106
}
105-
else
107+
108+
let suffix:Substring = self.id.suffix
109+
if suffix.starts(with: "SC") || suffix.starts(with: "So")
106110
{
107111
fallthrough
108112
}
109113

114+
throw SSGC.LexicalScopeError.multiple(existing, scope)
115+
110116
case nil:
111117
self.scopes.insert(scope)
112118
}

0 commit comments

Comments
 (0)