[Compiler][Swift] recursive unions with any poison the Equatable cache; nested ref targets stay value structs; keyword packages produce invalid identifiers
维护者通常 1 天内回复
评估
调研方向
The issue names three separate Swift codegen bugs: a poisoned Equatable cache for recursive unions, wrong ref-target lineage for nested messages, and keyword package names producing invalid backtick identifiers. Start with the repro in the issue (union Wrapper and message Node) and the Equatable cache in the Swift generator, then check the package-component escaping that joins with _. Pull request #4159 is already open against this issue, so coordinate with it before starting. Done means the generated Swift for the repro compiles and the nested ref and Any package cases produce valid identifiers.
由索引模型根据 Issue 内容生成。
描述
Three Swift codegen bugs in the compiler:
- When a union's Equatable check visits a message that refers back to the in-progress union, the message's provisional result is cached permanently. A later case of the same union (e.g.
any) overturns the union's answer, but the poisoned cache entry survives, so the message is emitted asstruct Node: Equatablewhose only stored property is non-Equatable — the generated Swift does not compile.
Repro:
union Wrapper { string note; Node node; any extra; }
message Node { Wrapper wrapper = 1; }
-
ref-target resolution inside nested messages uses the wrong parent lineage, so areffield in a nested message cannot resolve a sibling nested type; the target silently stays a value struct instead of being promoted tofinal class, breaking reference identity / wire-level ref-flag compatibility with Java and C++ (the identical top-level shape is promoted correctly). -
Package components are backtick-escaped individually and then joined with
_, so a package likeany(PascalCaseAny, a Swift keyword) produces identifiers like`Any`_Userand gRPC symbols like`Any`_GreeterProvider— backticks embedded mid-identifier are invalid Swift, so flatten-style and service output for such packages does not compile.
- 主要语言
- Java
- 星标
- 4.6k
- 派生
- 470
- 平均合并
- 9 小时 28 分钟
- 30 天内合并 PR
- 33
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/fory 的其他 Issue
-
[Python] Compatible xlang read silently drops fields when the peer writes camelCase/PascalCase names未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
[Build] Add ASF license headers to config files that allow comments可能重新可做 @Swatantra-66 于 27 天前认领,目前没有进行中的 PR。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
xlang: the snake_case conversion of field names is not specified, and the runtimes do not agree可能重新可做 @dhruv-dagar 于 15 天前认领,目前没有进行中的 PR。 未关闭bug
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
[Rust] Add an option to use Rust native enum可能已有人在做 @BaldDemian 于 19 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
apache/fory#4177 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Untyped read collapses a number literal that does not fit a double可能已有人在做 @mohitjoshi-hey 于 21 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 68/100
apache/fory#4170 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
5.0.x backport enhancement
难度 2/5 1-3 小时 新手友好度 63/100
spring-cloud/spring-cloud-function#1507 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
open-learning-exchange/myplanet#18484 ·
维护者通常 1 天内回复
-
ai-driven-fuzzing bug claude Minor
难度 2/5 1-3 小时 新手友好度 66/100
linagora/twake-calendar-side-service#1417 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
line/armeria#7109 · 3 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
open-feature/java-sdk-contrib#1966 ·
维护者通常 1 天内回复