From 92dc80ad6616f1fef72cfef1ae120e4fb5b41146 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 24 Oct 2026 18:04:52 +0000 Subject: feat(operator): select operator overloads by the expected result type Co-Authored-By: Claude Opus 5.5 --- AGENTS/PITFALLS/overload-template-operator.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'AGENTS/PITFALLS') diff --git a/AGENTS/PITFALLS/overload-template-operator.md b/AGENTS/PITFALLS/overload-template-operator.md index 6f23238..5718b2d 100644 --- a/AGENTS/PITFALLS/overload-template-operator.md +++ b/AGENTS/PITFALLS/overload-template-operator.md @@ -50,11 +50,13 @@ Part of the [pitfalls index](../PITFALLS.md). - Unary/binary operators require OVERLOAD FUNCTION, with supported arity and at least one record/class/enum operand. Pointer aliases alone do not qualify. -- Exact matching considers visible globals and left-class members together; ties are - errors, including private/public ties. -- Comparison and logic result types are declared, not assumed BOOLEAN; implicit - STRING to BOOLEAN is rejected. CASE comparisons must return BOOLEAN. AND/OR - overloads evaluate both operands. +- Exact matching considers visible globals and left-class members together, and the + result type joins the match when the context supplies one; ties are errors, + including private/public ties. Without a context, return-only-distinct candidates + are ambiguous; casts only prefer their target type. +- Comparison and logic result types are declared, not assumed BOOLEAN; a strict + BOOLEAN context requires an overload returning BOOLEAN. CASE comparisons must return + BOOLEAN. AND/OR overloads evaluate both operands. - Temporary member receivers are destroyed at statement end, including exception exits; ordinary DECLARE objects remain function-scoped. - Explicit calls use OPERATOR+(a,b) or a.OPERATOR+(b). -- cgit v1.3.1-4-g156e