Skip to content

Commit 51b5ab6

Browse files
committed
Fix
1 parent e9f4cdf commit 51b5ab6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Sources/JExtractSwiftLib/SwiftTypes/SwiftType.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,17 @@ extension SwiftType {
299299
lookupContext: SwiftTypeLookupContext
300300
) throws {
301301
// Look up the imported types by name to resolve it to a nominal type.
302-
guard let typeDecl = try lookupContext.unqualifiedLookup(name: Identifier(name)!, from: name) else {
303-
throw TypeTranslationError.unknown(originalType)
302+
let typeDecl: SwiftTypeDeclaration?
303+
if let parent {
304+
guard let parentDecl = parent.asNominalTypeDeclaration else {
305+
throw TypeTranslationError.unknown(originalType)
306+
}
307+
typeDecl = lookupContext.symbolTable.lookupNestedType(name.text, parent: parentDecl)
308+
} else {
309+
typeDecl = try lookupContext.unqualifiedLookup(name: Identifier(name)!, from: name)
310+
}
311+
guard let typeDecl else {
312+
throw TypeTranslationError.unknown(originalType)
304313
}
305314

306315
if let nominalDecl = typeDecl as? SwiftNominalTypeDeclaration {

0 commit comments

Comments
 (0)