Skip to content

Decide whether a macro is defined yet at a reference in one place - #389

Merged
jbearak merged 1 commit into
mainfrom
refactor/one-macro-position-check
Nov 5, 2026
Merged

jbearak merged 1 commit into
mainfrom
refactor/one-macro-position-check

Conversation

@jbearak

@jbearak jbearak commented Nov 5, 2026

Copy link
Copy Markdown
Owner

The analyzer (for diagnostics) and the providers (for go-to-definition and references) each had a copy of the rule for whether a macro is defined yet at a reference. Each copy had a LOCKSTEP comment asking that every change be made to the other too. If the copies drifted, a diagnostic could call a macro undefined while navigation resolved it, or the other way round.

The analyzer now runs its own preorder-index check, then calls the providers' macro_resolves_at_position for the visibility_start, line, and same-line rules. This deletes two helpers and the LOCKSTEP note. Behaviour is unchanged: every caller passes a range whose start line is the reference line. The old code compared range starts only, as the shared function does. A reference with only a line maps to the end of that line, which reproduces the old line-only branches.

Proof: typecheck, lint, and bun test ./tests pass, except the severity-settings property flake fixed in #388.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 65 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 0716646f-6b79-4706-9cce-b85acddfa8b6
Commits

Reviewing files that changed from the base of the PR and between 2091726 and 16764d4.

Files selected for processing: 2

  • src/analyzer/index.ts
  • src/utils/scoped-locals.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

The analyzer's macro_resolves_at_reference and the providers'
macro_resolves_at_position held the same visibility_start, line, and
same-line rules, with LOCKSTEP comments asking that every change be
copied to both. The analyzer now applies its preorder-index check and
then calls macro_resolves_at_position, so the rules exist once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jbearak
jbearak force-pushed the refactor/one-macro-position-check branch from 3d58e11 to 16764d4 Compare November 5, 2026 20:56
@jbearak
jbearak merged commit f5a0898 into main Nov 5, 2026
16 checks passed
@jbearak
jbearak deleted the refactor/one-macro-position-check branch November 5, 2026 21:02
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.

1 participant