From 1b829500c3c1d227a1c9933f172e374c488e4929 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Mon, 11 Sep 2023 21:35:01 +0000 Subject: [PATCH] fix: bigint from number conversion --- --- a/crates/jrsonnet-stdlib/src/strings.rs +++ b/crates/jrsonnet-stdlib/src/strings.rs @@ -161,7 +161,11 @@ use jrsonnet_evaluator::runtime_error; use Either2::*; Ok(match v { - A(a) => Val::BigInt(Box::new((a as i64).into())), + A(a) => { + Val::BigInt(Box::new(a.to_string().parse().map_err(|e| { + runtime_error!("number is not convertible to bigint: {e}") + })?)) + } B(b) => Val::BigInt(Box::new( b.as_str() .parse() -- gitstuff