All files / transpiler/logic/symbols TYPE_FORMING_KINDS.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                                      92x      
import TSymbolKindCNext from "../../types/symbol-kinds/TSymbolKindCNext";
 
/**
 * The symbol kinds whose declaration introduces a TYPE NAME.
 *
 * ADR-057 qualifies a bare type name against the enclosing scope only when the
 * name actually names a type -- a scope function or variable called `Config`
 * must not capture a global `struct Config` at a type position. That decision
 * was previously spread across four parallel `known*` sets, and #1281 proposed
 * adding a fifth (`knownCallbackTypes`) for the one kind the other four had
 * missed. A fifth set is the same bug again: the question "does this name form
 * a type" has one answer, and it belongs on the symbol's own kind.
 *
 * `function` is a member because ADR-029 makes a function definition create a
 * callback type. `variable` is excluded because ADR-057 says so, and
 * `enum_member`/`bitmap_field`/`register_member` are values inside a type, not
 * types.
 *
 * `register` is NOT a member. It reads like a type kind, but a register
 * declares a variable at an address; `CodeGenState.isScopeType` is measurably
 * `knownEnums | knownStructs | knownBitmaps` and has never included registers.
 * Adding it here would qualify a bare name matching a register declaration --
 * a C-Next behavior change. ADR-111 would make a register a type, but it is
 * `Research`, so ADR-004 remains in force and this exclusion stands. Revisit
 * when ADR-111 is implemented, not when it is merely Accepted.
 */
const TYPE_FORMING_KINDS: ReadonlySet<TSymbolKindCNext> =
  new Set<TSymbolKindCNext>(["enum", "struct", "bitmap", "function"]);
 
export default TYPE_FORMING_KINDS;