Extension blocks can declare user-defined operators for the extended
type. The green ExtensionOperators fixture pins what already
round-trips: declarations of all allowed static operator kinds
(arithmetic, bitwise, shifts incl. >>>, comparisons, unary, true/false,
checked variants, in parameters, a generic List<T> receiver, a string
receiver, and coexistence with the extended type's own operators) plus
their call sites, including checked contexts, compound assignment
through the static binary operator, and operator true in an if
condition. C# 14 disallows conversion operators in extension blocks
(CS9282), so there is nothing to cover there.
Two fixtures are Assert.Ignore'd as desired-output specs (#829):
ExtensionCompoundAssignmentOperators, because instance compound
assignment operators (+=, ++, checked variants) decompile as raw
[SpecialName] op_*Assignment methods carrying CompilerFeatureRequired,
which does not recompile (CS8335); and ExtensionOperatorCallSites,
because &&/|| via extension true/false, static ++/-- call sites and
lifted nullable operator uses are left as op_* calls or manual
HasValue/GetValueOrDefault expansions (recompilable but not
reconstructed). Both roslynLatest debug/opt configs compile the ignored
fixtures and fail only at the output comparison.
Assisted-by: Claude:claude-fable-5:Claude Code