docs: document covariant parameter matching#769
Conversation
Parameter matchers are covariant in their type argument, but the parameter-matching page never said so. Add a Covariant Type Matching subsection alongside Custom Equality Comparers (the other meta-feature that spans matcher families) with a chocolate-themed example showing both setup and verify narrowing on a derived type.
There was a problem hiding this comment.
Pull request overview
Adds missing documentation for covariant parameter matcher behavior, clarifying that matchers can narrow a base-type method parameter to a derived runtime type and that the same applies to verification.
Changes:
- Added a new “Covariant Type Matching” subsection to the parameter-matching docs.
- Included a setup + verify example demonstrating narrowing from
ChocolatetoDarkChocolate.
🚀 Benchmark ResultsDetails
Details
Details
Details
Details
Details
|
The example uses an abstract base, so there can be no base-typed instance — only sibling derived types fall through. Reword the paragraph to refer to "other runtime types" so it matches what the example actually demonstrates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
…hing (#769) by Valentin Breuß
…hing (#769) by Valentin Breuß
|
This is addressed in release v3.2.0. |



Parameter matchers are covariant in their type argument, but the parameter-matching page never said so. Add a Covariant Type Matching subsection alongside Custom Equality Comparers (the other meta-feature that spans matcher families) with a chocolate-themed example showing both setup and verify narrowing on a derived type.