Skip to content

Commit

Permalink
Fix bug with string concat binop
Browse files Browse the repository at this point in the history
  • Loading branch information
danhper committed Jul 24, 2024
1 parent e4e8c7c commit 22f79f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/interpreter/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl Add for Value {
(Value::Uint(a, s1), Value::Int(b, s2)) => {
Ok(Value::Int(I256::from_raw(a) + b, s1.max(s2)))
}
(Value::Str(a), Value::Str(b)) => Ok(Value::Str(a + &b)),
(Value::Str(a), Value::Str(b)) => return Ok(Value::Str(a + &b)),
_ => bail!(error_msg),
}
.and_then(Value::validate_int)
Expand Down
1 change: 1 addition & 0 deletions tests/interpreter_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ async fn test_binops() {
_check_result(&mut env, "int256(1) - 8", Value::from(-7)).await;
_check_result(&mut env, "3 + 8 * 4", Value::from(35u64)).await;
_check_result(&mut env, "(10 + 4) % 3", Value::from(2u64)).await;
_check_result(&mut env, "\"foo\" + \"bar\"", Value::from("foobar")).await;
}

#[tokio::test]
Expand Down

0 comments on commit 22f79f9

Please sign in to comment.