Decoding with and without configuration handles `container.currentIndex` differently in case of errors

According to documentation, if an error occurs during

try container.decode(T.self)

container.currentIndex is not incremented. That seems to be the case.

However, if I use

try container.decode(T.self, configuration: configuration)

container.currentIndex is incremented upon decoding errors.

Is there a reason for this behavior? Is it documented somewhere?

Here’s a sample Playground to reproduce the issue: GitHub - m4p/DecodableWithConfigurationBehaviourPlayground

2 Likes