navid/haze / commit

ac578357f89b

Navid M <navidmomtahen@gmail.com> · 2026-12-02

parents: ce973bf67063

Browse files at this commit · Download source

all: div and remainder by zero errors
--- /dev/null+++ b/samples/baseline_2.2/division_by_zero_error.hz@@ -0,0 +1,4 @@+fn main() {+    var x = 1 / 0+    print(x)+}--- a/src/eval.cpp+++ b/src/eval.cpp@@ -266,12 +266,12 @@             return ConstValue::from_int(x * y);         if (e.op == "/") {             if (y == 0)-                return std::nullopt;+                throw Error(e.pos, "division by zero");             return ConstValue::from_int(x / y);         }         if (e.op == "%") {             if (y == 0)-                return std::nullopt;+                throw Error(e.pos, "remainder by zero");             return ConstValue::from_int(x % y);         }         if (e.op == "<")