Skip to content

fix: Swift の複数行キャストと nil 合体式を正しく解析する - #37

Merged
owayo merged 1 commit into
mainfrom
fix/issue-32-swift-cast-coalescing
Oct 8, 2026
Merged

owayo merged 1 commit into
mainfrom
fix/issue-32-swift-cast-coalescing

Conversation

@owayo

@owayo owayo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

as? String の次の行に ?? を置く有効な Swift 式が構文エラーになり、後続の構造解析も崩れる問題を修正します。optional 型に隣接する ?? 用の external token を追加し、空白や改行を挟める nil 合体演算子から分離しました。既存の二重 optional 型と scanner の復元状態は維持します。

tree-sitter-swift 0.7.3 を Cargo のローカルパッチとして取り込み、元の MIT ライセンス、crate のチェックサム、文法ソースの出典、固定した generator/ABI、再生成・パッチ撤去の手順を同梱します。通常のビルドで Node.js や文法生成は不要です。

検証: 修正前の再現テスト失敗と修正後の成功を確認。Swift の上流 corpus 238 ケースについて、元の crate・元の文法の再生成・修正後の full AST がすべて一致しました。Swift 単体26件(新規9件・既存17件)、CLI6件(新規3件・既存3件)、vendor単体2件でキャスト・nil 合体式、通常/二重 optional、ソース範囲、構文エラーからの復帰、既存の構造解析を確認し、fmt/clippy/impact と公開内容の検査も通過しています。

既知の制限: value as? String/**/?? "fallback" は元の crate・再生成・修正後で同じ既存の AST 誤解析が残ります。この隣接コメントの別パターンは今回の改行による構文エラー修正の範囲外として記録しています。

Closes #32

@owayo owayo self-assigned this Oct 8, 2026
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7784bb26-2cbf-401b-92fd-4bae73303188
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@owayo
owayo merged commit 28f87eb into main Oct 8, 2026
9 checks passed
@owayo
owayo deleted the fix/issue-32-swift-cast-coalescing branch October 8, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Swift の複数行 nil 合体式と条件付きキャストが構文エラーになる

1 participant