Skip to content

Commit a8f2a53

Browse files
Merge pull request #20 from mattgallagher/issue-19
Fix issue 19 (a minor mistake in associated type paths).
2 parents a0c4138 + db33375 commit a8f2a53

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

CwlDemangle/CwlDemangle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ fileprivate extension Demangler {
12111211
var assocTypePath = [SwiftSymbol]()
12121212
repeat {
12131213
firstElem = pop(kind: .firstElementMarker) != nil
1214-
assocTypePath.append(try require(pop { $0.isDeclName }))
1214+
assocTypePath.append(try require(popAssociatedTypeName()))
12151215
} while !firstElem
12161216
return SwiftSymbol(kind: .assocTypePath, children: assocTypePath.reversed())
12171217
}

CwlDemangleTests/CwlDemangleAdditionalTests.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,21 @@ class CwlDemangleAdditionalTests: XCTestCase {
6262
XCTFail("Failed to demangle \(input). Got \(error)")
6363
}
6464
}
65+
66+
func testIssue18() throws {
67+
let symbol = try parseMangledSwiftSymbol("_$s7SwiftUI17_Rotation3DEffectV14animatableDataAA14AnimatablePairVySdAFy12CoreGraphics7CGFloatVAFyAiFyAiFyAFyA2IGAJGGGGGvpMV")
68+
print(symbol.description)
69+
}
70+
71+
func testIssue19() throws {
72+
let input = "_$s10AppIntents19CameraCaptureIntentP0A7ContextAC_SETn"
73+
let output = "associated conformance descriptor for AppIntents.CameraCaptureIntent.AppIntents.CameraCaptureIntent.AppContext: Swift.Encodable"
74+
do {
75+
let parsed = try parseMangledSwiftSymbol(input)
76+
let result = parsed.print(using: SymbolPrintOptions.default.union(.synthesizeSugarOnTypes))
77+
XCTAssert(result == output, "Failed to demangle \(input). Got\n\n\(result)\n, expected\n\n\(output)")
78+
} catch {
79+
XCTFail("Failed to demangle \(input). Got \(error)")
80+
}
81+
}
6582
}

0 commit comments

Comments
 (0)