Skip to content

Correct handling of Named Arguments - #300

Merged
viceroypenguin merged 1 commit into
mainfrom
issues/297
Jul 28, 2026
Merged

Correct handling of Named Arguments#300
viceroypenguin merged 1 commit into
mainfrom
issues/297

Conversation

@viceroypenguin

Copy link
Copy Markdown
Member

Fixes #297

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@viceroypenguin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

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).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4270cfc8-1a1c-4aa6-96fb-a678a649853c

📥 Commits

Reviewing files that changed from the base of the PR and between 713d005 and 72c1d43.

📒 Files selected for processing (3)
  • src/Immediate.Validations.Generators/ValidateTargetTransformer.cs
  • tests/Immediate.Validations.Tests/GeneratorTests/Snapshots/ValidatorArgumentTests.NameOfInNamedArgument#IV...ValidateClass.g.verified.cs
  • tests/Immediate.Validations.Tests/GeneratorTests/ValidatorArgumentTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issues/297

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

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 30370347066

Coverage remained the same at 83.852%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2217
Covered Lines: 1859
Line Coverage: 83.85%
Coverage Strength: 3.35 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes the mismatch described in #297 by ensuring [TargetType] values supplied via named attribute arguments (init-only validator properties) are resolved like member references (e.g., nameof(Password)instance.Password) rather than emitted as string literals.

Changes:

  • Update generator argument handling to pass the actual initializer property symbol into argument-value construction so [TargetType] detection works for named arguments.
  • Add a new generator test covering nameof(...) used in a named attribute argument for a [TargetType] init-only property.
  • Add/record the verified snapshot showing the generated code now passes the referenced member value (and preserves the comparison name metadata).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/Immediate.Validations.Tests/GeneratorTests/ValidatorArgumentTests.cs Adds a regression test for nameof inside a named attribute argument targeting an init-only [TargetType] property.
tests/Immediate.Validations.Tests/GeneratorTests/Snapshots/ValidatorArgumentTests.NameOfInNamedArgument#IV...ValidateClass.g.verified.cs Captures the expected generated output verifying comparison: instance.Password (not "Password").
src/Immediate.Validations.Generators/ValidateTargetTransformer.cs Fixes named-argument handling by passing the initializer property symbol into BuildArgumentValue, enabling [TargetType] nameof resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@viceroypenguin
viceroypenguin merged commit e391307 into main Jul 28, 2026
4 checks passed
@viceroypenguin
viceroypenguin deleted the issues/297 branch July 28, 2026 14:56
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.

TargetType init property does not resolve nameof member references

3 participants