diff --git a/src/parse/control_flow.rs b/src/parse/control_flow.rs index 77477eb..177a4ee 100644 --- a/src/parse/control_flow.rs +++ b/src/parse/control_flow.rs @@ -236,7 +236,7 @@ impl<'a> Parser<'a> { let from_val = self.parse_value_from_vec(from_toks, true)?; let from = match from_val.node { Value::Dimension(Some(n), ..) => match n.to_i32() { - Some(std::i32::MAX) | None => { + Some(std::i32::MAX) | Some(std::i32::MIN) | None => { return Err((format!("{} is not an int.", n), from_val.span).into()) } Some(v) => v, @@ -254,7 +254,7 @@ impl<'a> Parser<'a> { let to_val = self.parse_value(true, &|_| false)?; let to = match to_val.node { Value::Dimension(Some(n), ..) => match n.to_i32() { - Some(std::i32::MAX) | None => { + Some(std::i32::MAX) | Some(std::i32::MIN) | None => { return Err((format!("{} is not an int.", n), to_val.span).into()) } Some(v) => v, diff --git a/tests/for.rs b/tests/for.rs index 8e5d069..14ae5c5 100644 --- a/tests/for.rs +++ b/tests/for.rs @@ -166,3 +166,7 @@ error!( to_nan, "@for $i from 0 through (0/0) {}", "Error: NaN is not an int." ); +error!( + to_and_from_i32_min, + "@for $i from -2147483648 through -2147483648 {}", "Error: -2147483648 is not an int." +);