diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 15:07:27 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 15:21:14 +0000 |
| commit | f14b50d776ec743bd62fda22a9c154bba9588840 (patch) | |
| tree | 753196ff7881d0bfbcc29834277ffc14e2b4f440 /AGENTS | |
| parent | 8802a5d740d6cff29e473e7e0507b6a6d40a55e4 (diff) | |
feat(codegen)!: reject implicit BOOLEAN, CHAR and INTEGER mixing
Arithmetic and unary minus accept only INTEGER and REAL, AND/OR/NOT need
BOOLEAN, comparisons need equal types (or INTEGER with REAL), and only
INTEGER converts implicitly to REAL. Use ASC and CHR for characters.
No existing test program relied on the now-illegal mixing, so none changed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/CONVENTIONS/TYPES.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/AGENTS/CONVENTIONS/TYPES.md b/AGENTS/CONVENTIONS/TYPES.md index 664782e..1c0d548 100644 --- a/AGENTS/CONVENTIONS/TYPES.md +++ b/AGENTS/CONVENTIONS/TYPES.md @@ -25,6 +25,12 @@ Allocation sizes still use LLVM sizeof; native C type widths use build-compiler sizeof. C alias declarations precede casts using their names; the parser tracks declared type names to distinguish `(Type)operand` from `(expression)`. +**Builtin scalars are strictly typed.** `CodeGen::emitBinaryOp` (ExpressionGen.cc) +rejects arithmetic on BOOLEAN/CHAR, AND/OR on non-BOOLEAN, and comparisons between +different kinds (INTEGER with REAL is the only mixed pair); `emitCoercedExpr` allows +only INTEGER->REAL between the four builtin scalars. BOOLEAN (i1) and CHAR (i8) +compare unsigned. C scalars keep C semantics. + **User-kind typing is nominal, and checked upstream only.** Enum/Record/Pointer identity is case-insensitive name equality (`P1 = ^INTEGER` and `P2 = ^INTEGER` are incompatible; same-layout records too). Their LLVM representations are |
