ek9_make_abstract
Rewrites the declaration to 'as abstract' (replacing any 'as open') so the construct can no longer be instantiated; answers status, edits[] and wouldBeDiagnostics with every direct construction site (E10030).
When to use it
'Make Shape abstract' is one call with symbol:'Shape' - no file or line needed. Use it when a class/record/component/function should be a subclassing base that is never instantiated bare; abstract is implicitly open, so no separate 'as open' is needed.
When not to use it
- Removing 'as abstract' so the class can be instantiated again - use
ek9_make_concrete. - Wanting subclassability but STILL allowing direct instantiation — use
ek9_make_open('as open' alone, not abstract). - Wanting a fixed allow-only list of subtypes — use
ek9_seal_type(it keeps an existing 'as abstract' but never adds one; run this tool first for abstract+sealed). - Filling in abstract methods rather than locking them as abstract — use
ek9_implement_methods(opposite intent).
Details
Rewrites only the declaration line: strips any existing 'as open' (the two modifiers are mutually-exclusive grammar alternatives) and appends 'as abstract'; function style handled too ('myFunc() as pure' → 'myFunc() as pure abstract', reclassifying the genus to an abstract function). Breakage surfaces as would-fail — direct construction sites become E10030 CONSTRUCTOR_USED_ON_ABSTRACT_TYPE, and concrete-subclass cascades appear as new diagnostics. An already-abstract target is status:conflicts with kind 'already-abstract'; no supported declaration at the anchor, or a trait target (always abstract), is status:error.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
file | string | The EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site. | |
line | integer | 1-based line of the declaration or a reference - OMIT it and pass symbol:'<name>' to let the tool find the line (a model counting lines in a file miscounts); if you do count, use ek9_read_file(lineNumbers:true). | |
symbol | string | A construct NAME alone ('Shape', 'sample.deps.core::Validator') - no file needed, the tool finds it workspace-wide; or, with file (+ line), the identifier you mean there. |
It also takes the arguments every tool takes.
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Make abstract already noop
Request
{
"file" : "main.ek9",
"line" : 15
}
Response
{
"conflicts" : [ {
"kind" : "already-abstract",
"message" : "Class is already abstract — no change needed"
} ],
"edits" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "trivial",
"fileCount" : 0,
"lineCount" : 0,
"touchesPublicApi" : false,
"touchesTests" : false
},
"status" : "conflicts",
"summary" : "Class is already abstract — no change needed",
"workspaceHash" : "<workspace-hash>",
"wouldBeDiagnostics" : [ ],
"written" : false
}
Make abstract would fail
Request
{
"file" : "main.ek9",
"line" : 19
}
Response
{
"advisories" : [ {
"kind" : "apply-rolled-back",
"message" : "The changeset was committed, the post-apply compile introduced new error diagnostics (see wouldBeDiagnostics), and every file was restored — the workspace is unchanged. If the broken intermediate state is deliberate (a multi-step edit a later call would fix), land the complete final state in one apply — multi-mutation tools accept several mutations atomically, and a dirtyOverlay carrying the dependent files' content lets the apply land with verification deferred until those buffers are saved; otherwise fix the cause and re-apply."
} ],
"conflicts" : [ ],
"edits" : [ {
"after" : " ClosedBox as abstract",
"before" : " ClosedBox",
"endLine" : 19,
"file" : "main.ek9",
"startLine" : 19,
"type" : "replace"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"risk" : {
"crossesModuleBoundary" : false,
"estimatedSeverity" : "high",
"fileCount" : 1,
"lineCount" : 1,
"touchesPublicApi" : true,
"touchesTests" : false
...
Cut short here: 14 more lines. The whole recorded call.
See also
- Show me in the IDE: Make Abstract