ek9_query_type_hierarchy

Answers first: subtypeNames (implementedBy on a trait), superNames, traitNames, allowedSubtypes for a sealed trait - complete workspace-wide - then the full graph.

Category: Enquiry · Compare: Type Hierarchy (IntelliJ)

When to use it

'Who extends or implements X, and what does X extend' is one call with symbol:'X' - no file needed; file + line only from an IDE cursor.

When not to use it

Details

Hierarchy queries are meaningful only for CLASS, TRAIT, RECORD, COMPONENT; SERVICE/APPLICATION/PROGRAM/ENUMERATION return basic info with empty superChain/subtypes, and a location resolving to no aggregate type returns status:'not-found'. Two depth metrics: root-level `depth` is distance from the inheritance root DOWN to the queried type; each subtype's `depth` is distance FROM the queried type (1=direct child). `subtypes` holds ALL transitive descendants (counted by subtypeCount/summary.totalDescendants; summary.directSubtypes counts depth 1 only), plus isOpen (always) and, when applicable, transitive allTraits, sealed/allowedSubtypes/exhaustive, and generic markers.

Arguments

ArgumentTypeRequiredWhat it is
amongarray of stringNames to answer FOR: 'which of these ...' - the name lists shrink to these and amongUnmatched names the ones that are not in the answer. Bare names, 'mod::Type' or 'Type.member'; a MODULE name stands for every construct in it ('which in scale.m07 do not ...' = amongUnmatched).
columninteger0-based char offset of the target identifier on 'line' (an IDE cursor). OMIT it and pass symbol:'<name>' instead, or omit both and the first identifier on the line is taken (right for a declaration line). Reuse a column from ek9_inspect_symbol_at_cursor verbatim.
filestringThe EK9 source file - OPTIONAL when symbol is a construct name; required to anchor on a member or a use site.
lineinteger1-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).
symbolstringA 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.

Type hierarchy shape

Request

{
  "file" : "MyRecord.ek9",
  "line" : 5
}

Response

{
  "declaredAt" : {
    "file" : "MyRecord.ek9",
    "line" : 5
  },
  "depth" : 1,
  "fullyQualifiedName" : "com.example::MyRecord",
  "genus" : "RECORD",
  "isOpen" : false,
  "meta" : {
    "serverMs" : "<timing>"
  },
  "name" : "MyRecord",
  "status" : "ok",
  "subtypeCount" : 0,
  "subtypeNames" : [ ],
  "subtypeNamesCover" : "every descendant workspace-wide, direct and indirect - nothing to verify",
  "subtypes" : [ ],
  "summary" : {
    "directSubtypes" : 0,
    "superDepth" : 1,
    "totalDescendants" : 0,
    "traitCount" : 0
  },
...

Cut short here: 15 more lines. The whole recorded call.

See also