From 64622b737f070b377fdef3fb31a67c084457bd7b Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 15:11:38 +0000 Subject: 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 --- AGENTS/CONVENTIONS/TYPES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'AGENTS') 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 -- cgit v1.3.1-4-g156e