Repository navigation
fix(build): annotate ThumbHash cosine tables so Swift 6.3.3 can type-check them - #608
Conversation
…check them With Xcode 26.6 (Swift 6.3.3) the nested flatMap/map closures that build fxTable and fyTable in ThumbHashDecoder fail with "the compiler is unable to type-check this expression in reasonable time" on the Silo, SiloTV and SiloMac schemes. Give the tables and their closures explicit types so the compiler has nothing to infer. No behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe ChangesThumbHash type annotations
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change makes the cosine-table types explicit without changing the calculations or decoder behavior, so no new user-facing risk is evident and the PR is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Silo's pull request guidance changed today (#658). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: Needs the line 'Evidence: none, no user-visible change'. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
Problem
Related issue: N/A — narrow fix
maindoes not build with Xcode 26.6 (17F113, Apple Swift 6.3.3,swiftlang-6.3.3.1.3) on an Apple Silicon Mac. At0a4cce3, theSilo,SiloTVandSiloMacschemes all fail with the same two errors:The expressions are the nested
flatMap/mapclosures that buildfxTableandfyTableinThumbHashDecoder, added in #603.The "Apple regression" workflow passed on
0a4cce3. Its workflow file pins Xcode 26.3, so this looks specific to the newer compiler. I did not test Xcode 26.3 locally.Approach
Give both tables and their closures explicit types (
[Float32],Intparameters,Float32results) so the compiler has nothing to infer. The change is four lines in one file and does not change behaviour.The
letannotation alone is enough to compile. I kept the closure signatures as well so that each closure type-checks on its own.Validation
Platforms affected: iOS, tvOS and macOS (build only). All commands ran locally with Xcode 26.6 after
cd iosApp && xcodegen generate.Before the fix, at
0a4cce3:xcodebuild -project Silo.xcodeproj -scheme SiloMac -destination 'platform=macOS' -configuration Debug build:** BUILD FAILED **with the two errors abovexcodebuild build -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=NO:** BUILD FAILED **, same two errorsxcodebuild build -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' CODE_SIGNING_ALLOWED=NO:** BUILD FAILED **, same two errorsAfter the fix, at
9e0fddb:xcodebuild build -project Silo.xcodeproj -scheme SiloMac -destination 'platform=macOS':** BUILD SUCCEEDED **xcodebuild build -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=NO:** BUILD SUCCEEDED **xcodebuild test -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' CODE_SIGNING_ALLOWED=YES CODE_SIGN_IDENTITY=-:Executed 2519 tests, with 0 failures (0 unexpected),** TEST SUCCEEDED **xcodebuild test -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' -only-testing:SiloTVTests -parallel-testing-enabled NO CODE_SIGNING_ALLOWED=YES CODE_SIGN_IDENTITY=-:Executed 2302 tests, with 0 failures (0 unexpected),** TEST SUCCEEDED **The five existing
ThumbHashDecoderTestspass on both platforms. No test was added, because the change is type annotations only.Not run: a separate
SiloTVbuild-only command after the fix (the tvOS test run compiles the target), any build with Xcode 26.3, and the app itself.Evidence
Evidence: none, no user-visible change
Risks
None identified. The existing decoder tests check dimensions and alpha, not RGB values, so they would not catch a change in the cosine tables; the review below compared the old and new tables bit for bit instead.
Checklist
AI Disclosure
[Float], the type now stated. It comparedbitPatternof old and newfxTablevalues for widths 1 to 32 and stops 3 to 7 and found 0 mismatches;fyTableis the same expression and was not compared separately. It found no correctness issue and raised two low-severity points: the tests assert no pixel values (predates this change, noted under Risks), and the closure signatures are redundant given theletannotations (kept, see Approach). It did not runxcodebuildor test the iOS or tvOS SDKs.🤖 Generated with Claude Code
Note
Fix Swift 6.3.3 type-checking of ThumbHash cosine tables
Adds explicit
Float32array and closure type annotations to the cosine lookup-table construction inThumbHashDecoder.decodeRGBAin ThumbhashImage.swift. This lets the Swift 6.3.3 compiler type-check the expressions. No runtime behavior changes.Macroscope summarized 9e0fddb.