Generic type is ignored
tahirmt opened this issue · comments
Mahmood Tahir commented
Describe the bug
When trying to dump a generic type, the generic information is not included in the dump
To Reproduce
func testGeneric() {
struct Box<T> {
let value: T
}
let stringBox = Box(value: "test")
var dump = ""
customDump(
stringBox,
to: &dump
)
XCTAssertNoDifference(
dump,
"""
DumpTests.Box(value: \"test\")
"""
)
// Expecting the dump to be DumpTests.Box<String>(value: \"test\") instead
}
Expected behavior
Expecting the generic type information to be included in the dump i.e. DumpTests.Box<String>(value: \"test\")
Environment
- swift-custom-dump version [e.g. 0.6.0]
- Xcode [e.g. 13.4.1]
- Swift [e.g. 5.6]
- OS: [e.g. macOS 12.6]
Stephen Celis commented
We try to omit extraneous type information wherever possible to keep dumps compact, but I agree the generics sometimes help. Here, though, we can see that value
is a string, so I suppose omitting the generic is fine. Do you have some real world examples where the generic is crucial?