git.delta.rocks / jrsonnet / refs/commits / 1b829500c3c1

difftreelog

fix bigint from number conversion

Yaroslav Bolyukin2023-09-11parent: #3248f25.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth
161 use jrsonnet_evaluator::runtime_error;161 use jrsonnet_evaluator::runtime_error;
162 use Either2::*;162 use Either2::*;
163 Ok(match v {163 Ok(match v {
164 A(a) => Val::BigInt(Box::new((a as i64).into())),164 A(a) => {
165 Val::BigInt(Box::new(a.to_string().parse().map_err(|e| {
166 runtime_error!("number is not convertible to bigint: {e}")
167 })?))
168 }
165 B(b) => Val::BigInt(Box::new(169 B(b) => Val::BigInt(Box::new(
166 b.as_str()170 b.as_str()
167 .parse()171 .parse()