This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 891104fdbfcb9950915911315add0f78e7a560e6 Author: chaokunyang <[email protected]> AuthorDate: Mon Jul 27 05:33:11 2026 +0000 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/' --- docs/compiler/generated-code.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md index 5dbe6b6f99..4fe69ba30d 100644 --- a/docs/compiler/generated-code.md +++ b/docs/compiler/generated-code.md @@ -1172,7 +1172,8 @@ public enum Addressbook { @ForyField(id: 1) public var name: String = "" @ForyField(id: 8) - public var pet: Addressbook.Animal = .foryDefault() + public var pet: Addressbook.Animal = + Addressbook.Animal.dog(Addressbook.Dog()) } } ``` @@ -1187,7 +1188,12 @@ public struct Addressbook_Person: Equatable { ... } The CLI flag `--swift_namespace_style` overrides schema option `swift_namespace_style` when both are set. Unions are generated as tagged Swift enums with associated payload values. +Recursive unions are emitted as `indirect` enums. The first known union case +must have a finite recursively constructible default; the compiler rejects a +first-case default cycle instead of emitting a non-terminating initializer. Messages with `ref`/`weak_ref` fields are generated as `final class` models to preserve reference semantics. +A directly stored message cycle must mark at least one cycle edge `ref`; otherwise +the compiler rejects the schema because Swift value types cannot represent it. Fixed or tagged integer encodings inside list/map fields are emitted as Swift field type hints, for example `@ListField(element: .encoding(.fixed))` or `@MapField(value: .encoding(.tagged))`. @@ -1203,8 +1209,8 @@ Each schema includes a `ForyModule` owner with transitive import installation: public enum ForyModule { public static func install(_ fory: Fory) throws { try ComplexPb.ForyModule.install(fory) - fory.register(Addressbook.Person.self, id: 100) - fory.register(Addressbook.Animal.self, id: 106) + try fory.register(Addressbook.Person.self, id: 100) + try fory.register(Addressbook.Animal.self, id: 106) } } ``` --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
