ek9_collapse_to_default_operator

Replaces the operator's declaration and body with the one-line 'default operator <sym>' form (the inverse of ek9_expand_default_operator); answers status, edits[] and summary.

Category: Editor · Compare: Code Cleanup → Use Default Implementation (no direct equivalent)

When to use it

'Collapse Order's hand-written == back to default operator ==' is one call with symbol:'Order' and operator:'==' - the body must be default-equivalent.

When not to use it

Details

Class/record/component only; the defaultable set is <=> == ? $ $$ #? :=: - <> < <= > >= are generated from the sameness and never written or requested (E07181; E07180 where the type has no <=> to generate them from), and any other operator errors ('cannot be defaulted'). The operator's declaration is found by name; two explicit declarations of the same symbol (overloads) are a conflict listing their lines - pass line to pick one. The whole declaration + body is replaced without being diffed against the compiler's synthesis, so a customised body is silently lost. The verify compile only catches breakage the collapse itself introduces (e.g. E07030 default-on-trait, E07190 super missing '<=>', a field type lacking the operator).

Arguments

ArgumentTypeRequiredWhat it is
filestringThe EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site.
lineintegerIDE refinement: the 1-based line of the operator declaration. Omit it - the declaration is found by symbol + operator; needed only when two overloads declare the same operator.
operatorstringyesThe operator to collapse, in EK9 source form ('==', '<=>', '$'); must be in the defaultable set.
symbolstringyesThe class, record or component holding the operator - a bare name ('Order') finds its file workspace-wide; 'mod::Order' when the name is declared in two modules.

It also takes the arguments every tool takes.

See also