Skip to content

Commit

Permalink
Fix issue 19 (a minor mistake in associated type paths).
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgallagher committed Feb 10, 2025
1 parent 9d47033 commit db33375
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CwlDemangle/CwlDemangle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ fileprivate extension Demangler {
var assocTypePath = [SwiftSymbol]()
repeat {
firstElem = pop(kind: .firstElementMarker) != nil
assocTypePath.append(try require(pop { $0.isDeclName }))
assocTypePath.append(try require(popAssociatedTypeName()))
} while !firstElem
return SwiftSymbol(kind: .assocTypePath, children: assocTypePath.reversed())
}
Expand Down
17 changes: 17 additions & 0 deletions CwlDemangleTests/CwlDemangleAdditionalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,21 @@ class CwlDemangleAdditionalTests: XCTestCase {
XCTFail("Failed to demangle \(input). Got \(error)")
}
}

func testIssue18() throws {
let symbol = try parseMangledSwiftSymbol("_$s7SwiftUI17_Rotation3DEffectV14animatableDataAA14AnimatablePairVySdAFy12CoreGraphics7CGFloatVAFyAiFyAiFyAFyA2IGAJGGGGGvpMV")
print(symbol.description)
}

func testIssue19() throws {
let input = "_$s10AppIntents19CameraCaptureIntentP0A7ContextAC_SETn"
let output = "associated conformance descriptor for AppIntents.CameraCaptureIntent.AppIntents.CameraCaptureIntent.AppContext: Swift.Encodable"
do {
let parsed = try parseMangledSwiftSymbol(input)
let result = parsed.print(using: SymbolPrintOptions.default.union(.synthesizeSugarOnTypes))
XCTAssert(result == output, "Failed to demangle \(input). Got\n\n\(result)\n, expected\n\n\(output)")
} catch {
XCTFail("Failed to demangle \(input). Got \(error)")
}
}
}

0 comments on commit db33375

Please sign in to comment.