diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-23 22:19:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-23 22:19:52 +0300 |
| commit | d50dec3930ff9ecae590e4ec4f0ddd5581021f1d (patch) | |
| tree | fbccbd7887335c3f4fdde9c684db6d036ca598da | |
| parent | aa836f747d99698b174294d602be7a065c9088e2 (diff) | |
refactor: remove dead Symbol checks from Modulo
Remove explicit Symbol type checks from Modulo() that are never reached.
The toFloat64() helper already rejects non-numeric types (including Symbol)
with a proper error, so the Symbol-specific error messages in Modulo are
dead code. This makes Modulo consistent with Add, Subtract, Multiply,
Divide, and other operators that rely solely on toFloat64() for type
validation.
| -rw-r--r-- | internal/rpn/operations_arithmetic.go | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/internal/rpn/operations_arithmetic.go b/internal/rpn/operations_arithmetic.go index 2df45bd..3215917 100644 --- a/internal/rpn/operations_arithmetic.go +++ b/internal/rpn/operations_arithmetic.go @@ -193,13 +193,6 @@ func (o *Operations) Modulo(stack *Stack) error { return err } - if sym, ok := a.(*Symbol); ok { - return fmt.Errorf("symbol %s cannot be used with modulo operator", sym.Name()) - } - if sym, ok := b.(*Symbol); ok { - return fmt.Errorf("symbol %s cannot be used with modulo operator", sym.Name()) - } - bF, err := toFloat64(b, "%") if err != nil { return err |
