diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 15:11:38 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 15:21:14 +0000 |
| commit | 64622b737f070b377fdef3fb31a67c084457bd7b (patch) | |
| tree | 8111bfcf325ed9162dac645a0c68536bad954820 /AGENTS | |
| parent | f14b50d776ec743bd62fda22a9c154bba9588840 (diff) | |
feat(codegen)!: require explicit REAL to INTEGER conversion and add INT
Implicit REAL to INTEGER is now a compile error with an INT(...) hint.
INT is a compiler builtin that truncates toward zero and raises a runtime
error for NaN or values outside the INTEGER range.
No existing test program relied on the implicit conversion.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS')
| -rw-r--r-- | AGENTS/CONVENTIONS/TYPES.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/AGENTS/CONVENTIONS/TYPES.md b/AGENTS/CONVENTIONS/TYPES.md index 1c0d548..f5764d4 100644 --- a/AGENTS/CONVENTIONS/TYPES.md +++ b/AGENTS/CONVENTIONS/TYPES.md @@ -28,7 +28,7 @@ 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) +only INTEGER->REAL between the four builtin scalars. REAL->INTEGER therefore errors (with an `INT(...)` hint); `INT` is a compiler builtin (`Builtins.h`, `CodeGen::emitIntBuiltin`) truncating toward zero with a range check. BOOLEAN (i1) and CHAR (i8) compare unsigned. C scalars keep C semantics. **User-kind typing is nominal, and checked upstream only.** Enum/Record/Pointer |
