Skip to content

fix: Swift の宣言名を refs で定義として分類する - #44

Merged
owayo merged 1 commit into
mainfrom
fix/issue-42-swift-declaration-refs
Oct 8, 2026
Merged

owayo merged 1 commit into
mainfrom
fix/issue-42-swift-declaration-refs

Conversation

@owayo

@owayo owayo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

概要

Swift の let / var、型別名、列挙子、protocol 要件の宣言名を refs で def として返すようにしました。

原因と修正

プロパティ名は宣言ノード直下ではなく name の pattern 内にあるため、既存の定義判定から漏れていました。束縛位置をたどる判定を追加し、複数宣言とタプル分解を扱います。列挙子の複数の name もすべて判定します。

タプルのラベル、型注釈、初期化子、使用箇所は ref のままです。

検証

  • swiftc -typecheck tests/fixtures/swift_declaration_refs.swift
  • cargo test
  • make check
  • cargo build --release
  • astro-sight impact --dir . --git
  • astro-sight review --dir . --git

Closes #42

Swift のプロパティ、型別名、列挙子、protocol 要件の名前が参照として数えられていた。
宣言の name フィールドと、プロパティの pattern 内の束縛位置を判定する。
タプルのラベル、型注釈、初期化子の参照は維持する。

回帰テスト: refs_swift_declarations_are_definitions_without_reclassifying_uses
Issue: #42
@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: b3656a5a-22e2-4945-8ef8-487fc727d3b6
  • 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 78041dc into main Oct 8, 2026
9 checks passed
@owayo
owayo deleted the fix/issue-42-swift-declaration-refs branch October 8, 2026 19:01
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.

Swift の let / var の宣言 (static・インスタンス・トップレベル) が、refs で def ではなく ref になる

1 participant