From 5a67f4e3833c2acca4a351f5dd613bc08f04bfc0 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 18 Oct 2026 06:11:42 +0000 Subject: feat(operators): document overloads and cover remaining operator forms Add fixed cases for every supported operator, imported global and member operators, CASE comparisons, and declared result type errors. Document syntax, exact matching, access rules and temporary receiver lifetimes. Co-Authored-By: Claude Opus 5.5 --- AGENTS/SUBSYSTEMS.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'AGENTS/SUBSYSTEMS.md') diff --git a/AGENTS/SUBSYSTEMS.md b/AGENTS/SUBSYSTEMS.md index ac31cde..be20bc3 100644 --- a/AGENTS/SUBSYSTEMS.md +++ b/AGENTS/SUBSYSTEMS.md @@ -43,6 +43,16 @@ compile error (no extern is fabricated). Functions inherit visible GLOBAL storag `StmtEmitter` callback, and must restore its own insert point (and the exchanged ArrayTable) afterwards. +**Operator overloads** (`OperatorGen.cc`): PrototypeAST retains the operator token; +FunctionGen validates operand count and requires a record/class/enum operand. +Global signatures and left-class methods share exact-type selection, used by +ValueTypeGen and ExpressionGen before builtin operations. Missing candidates leave +builtin rules intact; ties are errors. Member access is checked after selection. +The raw-expression argument-marshalling overload borrows AST pointers for operator +calls; ordinary calls adapt their unique_ptr lists into it. Member receivers use +lvalue storage or a materialized, Alive-tracked temporary. CASE calls the value +entry point with its already captured selector and requires BOOLEAN results. + **EXTERN "C"** (`ExternDeclAST`, `IncludeObjStmtAST`): the parser builds a body-less `PrototypeAST` (IsExternal, IsVariadic, unnamed `argN` params). `FunctionGen::emitExternPrototype` validates C types, records a `FuncSig` with `IsExternal`, the declared `FunctionType` and @@ -71,7 +81,7 @@ constants live in a TypeSystem-owned table, resolved in `emitExpr`'s `VariableExprAST` branch after `Symbols` misses. The lvalue layer (`emitLValue`/`loadFromLValue`) resolves designator chains to `{address, type name}`; `emitCoercedExpr` is the single name-level admission gate; `emitUserKindBinaryOp` -intercepts binary operators ahead of ArithmeticHandler (which, like StringHandler and +intercepts built-in binary operators ahead of ArithmeticHandler (which, like StringHandler and FileHandler, is deliberately ignorant of user kinds). The enum range check after `E ± INTEGER` is the only site that can produce an invalid ordinal — every other producer (constants, same-name copies, zero-init, memset-0 arrays) is valid by -- cgit v1.3.1-4-g156e