square / wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
https://square.github.io/wire/
Apache License 2.0
4.23k stars 572 forks source link

[swift] handle edge for defaulted value when it collides a sub-type name #2938

Closed dnkoutso closed 3 months ago

dnkoutso commented 3 months ago

We hit an edge case in which a sub-type in a message is the same name as the message itself. The Swift compiler trips thinking the sub-field is the one to provide as the default value which does not seem to work.

This makes sure we avoid this collision.

A test is added that failed to compile before this change.