Repository navigation
fix(swift): index every case of a comma-separated enum case list - #3200
Open
bob-codedaptive wants to merge 1 commit into
Open
bob-codedaptive wants to merge 1 commit into
bob-codedaptive wants to merge 1 commit into
Conversation
case object([Int]), array([Value]), null indexed only its first case: both the TypeScript extractor and the native kernel read one name field from the enum entry. Every name field now becomes an enum member, on both paths with identical results; a single-case entry is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
case object([Int]), array([Value]), boolean(Bool), nullis oneenum_entryin the Swift grammar with fournamefields. Both extractors read a singlenamefield, so onlyobjectwas indexed.array,booleanandnullwere missing from search, callers and impact, and anything that looked a case up by name saw an enum without them.What this changes
Every
namefield of anenum_entrybecomes anenum_member, in both extractors (extractEnumMembersfor the wasm path andextract_enum_membersin the native kernel), with identical results. A single-case entry is unchanged and still spans the whole entry; each case of a multi-case entry spans its own name. Node ids come from the name and line, and the column only separates a collision.docs/design/swift-kernel-port-checklist.mdand the two header comments that listed first-case-only minting as a quirk to preserve now describe every case being kept.Tests
__tests__/swift-enum-multi-case.test.tshas a wasm arm and a kernel arm that must mint the same nodes. The kernel arm runs when a kernel is staged (npm run build:kernel), like the kernel parity suite.npx vitest run __tests__/swift-enum-multi-case.test.ts, wasm arm: 1 test, passes. On current main, without thetree-sitter.tschange, it fails (array,booleanandnullare missing).npm run build:kernel); the kernel built on the author's machine would not load, so the arm andkernel-swift-parity.test.tswere skipped.The existing corpus in
__tests__/fixtures/kernel-parity/torture.swiftholds no multi-case entry, sokernel-swift-parity.test.tsdoes not exercise this on its own; the new test's kernel arm does.🤖 Generated with Claude Code