v1.2.0
Added
-
Delegates, lambdas and method groups satisfy an interface with a single method (a functional interface), both as
[DuckTyped]arguments and throughDuck.As. -
A
[DuckTyped]method converts to a delegate over the duck type (Func<Person, string> f = Ops.Describe;,items.Select(Ops.Describe)) through a generated overload. -
static abstractmembers and operators via duck-typed constraints (where T : IAddable<T>), including BCL generic math interfaces such asIAdditionOperators<T, T, T>. The generated adapter is its own type argument, so these calls don't box. -
Samples:
IfItQuacks.Sample.DelegatesandIfItQuacks.Sample.GenericMath. -
Documentation: a Benchmarks page with measured numbers (BenchmarkDotNet,
MemoryDiagnoser) for duck-typed calls and forDuck.Asused as a view instead of a mapper. -
Samples:
IfItQuacks.Sample.Members(events, indexers,refreturns, default interface members) andIfItQuacks.Sample.Signatures(ref/out/paramsparameters,privatemethods, methods on a struct, runtime fallback).
Changed
- Documentation: Known limitations is grouped into fewer sections, each showing the code that doesn't work.
Fixed
IFITQUACKS005no longer mentionsrefreturns, which are supported now, and its title matches the documentation.- Interface properties and indexers with an
initsetter are adapted correctly. A type whose setter isinit-only is reported as a mismatch instead of producing invalid code. [DuckTyped]methods in an interface or in afile-local type are reported withIFITQUACKS004instead of silently generating code for a different type.readonlyandrefstruct containing types keep their modifiers.- Members inherited from base interfaces are found when the argument is statically typed as an interface.
- A member of the argument's type that hides the inherited member the interface was matched against no longer breaks the generated adapter.
- Type argument inference skips static and generic candidate members and honours
refreturns, matching the rules used for structural matching.