You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Decoder does not restore the parent value after decoding a child #3
Save the test as Sources/Tests/DecoderStateTests.swift, then run from the repository root:
swift test --filter restoresParentValueAfterDecodingChild
Expected behavior
If the decoder is intended to restore its parent context after decoding a child, currentNodeType should remain .object, and reopening the parent's keyed container should succeed.
Actual behavior
After decoding name, the current node is a string. Reopening the keyed container throws:
Expected an instance of dictionary but an instance string was specified
Stack trace
N/A — this produces an assertion failure and a thrown error, not a crash.
Swift version: Apple Swift 6.4 (swiftlang-6.4.0.34.1)
Xcode: 27.2 beta (27B5019j)
Additional context
I reproduced this with a standalone probe against the library, but have not found an existing public Project decoding case affected by it. Existing decoding implementations that retain their original container may not encounter the issue.
Is restoring the parent value the intended behavior? If so, changing the saved value to currentValue appears to address it. I would be happy to submit a focused fix with regression tests covering restoration after both successful and throwing child decodes.
Activity