Skip to content

feat!: match parameter subtypes in WithParameter and add WithExactParameter#206

Merged
vbreuss merged 1 commit into
mainfrom
topic/change-withparameter-behavior
May 28, 2026
Merged

feat!: match parameter subtypes in WithParameter and add WithExactParameter#206
vbreuss merged 1 commit into
mainfrom
topic/change-withparameter-behavior

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented May 28, 2026

Make WithParameter<T> on methods and constructors match parameters assignable to T (including subtypes) instead of requiring an exact type, mirroring WhichReturn<T>. Add WithExactParameter<T> for the previous exact-match behavior, mirroring WhichReturnExactly<T>.

BEHAVIOR CHANGE: WithParameter<T>() now matches parameters of subtypes of T. Use WithExactParameter<T>() to restore exact-type matching.


…ameter

Make `WithParameter<T>` on methods and constructors match parameters assignable to `T` (including subtypes) instead of requiring an exact type, mirroring `WhichReturn<T>`. Add `WithExactParameter<T>` for the previous exact-match behavior, mirroring `WhichReturnExactly<T>`.

BREAKING CHANGE: `WithParameter<T>()` now matches parameters of subtypes of `T`. Use `WithExactParameter<T>()` to restore exact-type matching.
@vbreuss vbreuss self-assigned this May 28, 2026
@vbreuss vbreuss added the enhancement New feature or request label May 28, 2026
@vbreuss vbreuss enabled auto-merge (squash) May 28, 2026 10:55
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Test Results

    13 files  ± 0      13 suites  ±0   3m 6s ⏱️ -6s
 3 090 tests + 8   3 087 ✅ + 8   3 💤 ±0  0 ❌ ±0 
18 520 runs  +48  18 507 ✅ +48  13 💤 ±0  0 ❌ ±0 

Results for commit f35fd44. ± Comparison against base commit 65a408a.

@vbreuss vbreuss merged commit a1807b6 into main May 28, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/change-withparameter-behavior branch May 28, 2026 11:01
@github-actions
Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 3.20GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.300
[Host] : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Gen0 Allocated
TypeIsNotStatic_aweXpect 223.8 ns 1.23 ns 0.96 ns 0.0386 648 B

@github-actions
Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Reflection

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
Filters/ConstructorFilters.WithExactParameter.cs 75.00% 12 2 0 2 6 0 12 4 22
Filters/ConstructorFilters.WithParameter.cs 83.33% 30 0 0 6 21 1 30 6 58
Filters/MethodFilters.WithExactParameter.cs 75.00% 12 2 0 2 6 0 12 4 22
Filters/MethodFilters.WithParameter.cs 83.33% 30 0 0 6 21 1 30 6 58

The final mutation score is 80.77%

Coverage Thresholds: high:80 low:60 break:0

@github-actions
Copy link
Copy Markdown

This is addressed in release v1.3.0.

@github-actions github-actions Bot added the state: released The issue is released label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WithParameter<T> uses exact type matching — inconsistent with WhichReturn<T>

1 participant