Type-check the operator precedence table #52
Loading…
Reference in a new issue
No description provided.
Delete branch "us5/type-check-operator-precedence"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #5.
Summary
Expr::Binary/Expr::Unaryacross the full operator set: arithmetic (+ - * / % **), ordering (< <= > >=), equality (== !=), logical (&& ||), and unary (- ! &).DiagnosticKindvariants:BinaryOpMismatch(operands disagree),InvalidBinaryOpType/InvalidUnaryOpType(operands agree but the operator isn't defined for that type).check_matching_operand_binaryhelper (parameterized by a return-type override and an allowed-operand predicate) covers every binary group that needs "operands must agree, and the shared type must be valid" — bundled via aBinaryOperandstruct to stay under clippy's argument-count lint.Eq/NeacceptInt | Float | Bool | String(equality needs no new semantics); ordering staysInt | Floatonly (string ordering/concat are undecided insyntax-notes.md, deliberately deferred).RangeEx/RangeIncandUnaryOp::PointerRefstay silent (None, no diagnostic) — noTy::Range/pointer type exists yet, consistent with how every other not-yet-checkedExprvariant is treated.Nonecases.docs/type-checker-design.mdgets a new## Issue #5section documenting these decisions (docs/syntax-status.mdis lexer/parser-scoped only, per its own header, so it wasn't touched).Test plan
cargo test --workspacecargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningsCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01WNg6dnsh1WPghP4FuNHThj