From fd417da04f7ca4b995de7f6510abafd3e9c31307 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 6 Jun 2023 21:13:59 +0200 Subject: Improve value casting infrastructure --- src/eval/ops.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/eval/ops.rs') diff --git a/src/eval/ops.rs b/src/eval/ops.rs index 3e397c30..bea2ea82 100644 --- a/src/eval/ops.rs +++ b/src/eval/ops.rs @@ -209,8 +209,8 @@ pub fn mul(lhs: Value, rhs: Value) -> StrResult { (Int(a), Str(b)) => Str(b.repeat(a)?), (Array(a), Int(b)) => Array(a.repeat(b)?), (Int(a), Array(b)) => Array(b.repeat(a)?), - (Content(a), Int(b)) => Content(a.repeat(b)?), - (Int(a), Content(b)) => Content(b.repeat(a)?), + (Content(a), b @ Int(_)) => Content(a.repeat(b.cast()?)), + (a @ Int(_), Content(b)) => Content(b.repeat(a.cast()?)), (a, b) => mismatch!("cannot multiply {} with {}", a, b), }) -- cgit v1.2.3