Skip to content

Improve @Variant diagnostics, name handling, and default-argument support#1

Merged
takasek merged 2 commits into
mainfrom
claude/improvement-ideas-getn1r
Jun 20, 2026
Merged

Improve @Variant diagnostics, name handling, and default-argument support#1
takasek merged 2 commits into
mainfrom
claude/improvement-ideas-getn1r

Conversation

@takasek

@takasek takasek commented Jun 20, 2026

Copy link
Copy Markdown
Owner
  • Treat explicit empty name: as a verbatim value instead of silently
    falling back to the member name.
  • Diagnose non-constant name: (interpolated/computed) instead of
    silently ignoring it and using the member name.
  • Allow static func parameters with default values to be omitted from
    @variant (pass between required and total parameter count).
  • Warn on duplicate explicit names across members/cases.
  • Point argument-count and stored-property diagnostics at the offending
    @variant attribute rather than the whole declaration.
  • Offer a fix-it that inserts a name: placeholder for the
    missing-name-with-multiple-@variant warning.
  • Add runtime tests that exercise the generated code end-to-end, plus
    tests for the new diagnostics and behaviors.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01XYWfJmDzCJrBaESbryzg4L

claude added 2 commits June 20, 2026 09:08
…port

- Treat explicit empty name: as a verbatim value instead of silently
  falling back to the member name.
- Diagnose non-constant name: (interpolated/computed) instead of
  silently ignoring it and using the member name.
- Allow static func parameters with default values to be omitted from
  @variant (pass between required and total parameter count).
- Warn on duplicate explicit names across members/cases.
- Point argument-count and stored-property diagnostics at the offending
  @variant attribute rather than the whole declaration.
- Offer a fix-it that inserts a name: placeholder for the
  missing-name-with-multiple-@variant warning.
- Add runtime tests that exercise the generated code end-to-end, plus
  tests for the new diagnostics and behaviors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYWfJmDzCJrBaESbryzg4L
A private type's generated allVariants was emitted as `private`, which is
not visible from the separate conformance extension, so the protocol
requirement could not be satisfied (the compiler asks for `fileprivate`).
Map both `private` and `fileprivate` types to `fileprivate` members.

This was a latent bug surfaced by the new end-to-end runtime tests, which
use a private type.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYWfJmDzCJrBaESbryzg4L
@takasek takasek merged commit c0afb74 into main Jun 20, 2026
2 checks passed
@takasek takasek deleted the claude/improvement-ideas-getn1r branch June 20, 2026 10:14
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.

2 participants