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.git
The following commit(s) were added to refs/heads/main by this push:
new 5ffb98966 fix(swift): fix swift generated code compile warnings (#3566)
5ffb98966 is described below
commit 5ffb9896667a1987edec156f7548790522afdeb2
Author: Shawn Yang <[email protected]>
AuthorDate: Tue Apr 14 20:26:17 2026 +0800
fix(swift): fix swift generated code compile warnings (#3566)
## Why?
## What does this PR do?
## Related issues
## AI Contribution Checklist
- [ ] Substantial AI assistance was used in this PR: `yes` / `no`
- [ ] If `yes`, I included a completed [AI Contribution
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
in this PR description and the required `AI Usage Disclosure`.
- [ ] If `yes`, my PR description includes the required `ai_review`
summary and screenshot evidence of the final clean AI review results
from both fresh reviewers on the current PR diff or current HEAD after
the latest code changes.
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---
swift/Sources/ForyMacro/ForyObjectMacroPrimitiveFastPath.swift | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/swift/Sources/ForyMacro/ForyObjectMacroPrimitiveFastPath.swift
b/swift/Sources/ForyMacro/ForyObjectMacroPrimitiveFastPath.swift
index c043f327c..2ad026db2 100644
--- a/swift/Sources/ForyMacro/ForyObjectMacroPrimitiveFastPath.swift
+++ b/swift/Sources/ForyMacro/ForyObjectMacroPrimitiveFastPath.swift
@@ -338,7 +338,9 @@ private func buildPrimitiveFastReadBlock(
}
"""
)
- readSections.append("let __length = __bytes.count")
+ if readLayout.consumedExpr == "__readerIndex" {
+ readSections.append("let __length = __bytes.count")
+ }
readSections.append(contentsOf: readLayout.statements)
readSections.append("return \(readLayout.consumedExpr)")
let readBody = readSections.joined(separator: "\n ")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]