Skip to content

Commit

Permalink
Auto convert int to string
Browse files Browse the repository at this point in the history
Fix #119
  • Loading branch information
Riey committed Feb 10, 2023
1 parent 43348fe commit 6f466a0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/erars-vm/src/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 1064,11 @@ impl VmVariable {
*i.get_mut(idx as usize)
.ok_or_else(|| anyhow!("Variable out of range {}", idx))? = n;
}
// auto convert int to string
(Self::Str(i), Value::Int(n)) => {
*i.get_mut(idx as usize)
.ok_or_else(|| anyhow!("Variable out of range {}", idx))? = n.to_string();
}
(Self::Str(i), Value::String(s)) => {
*i.get_mut(idx as usize)
.ok_or_else(|| anyhow!("Variable out of range {}", idx))? = s;
Expand Down

0 comments on commit 6f466a0

Please sign in to comment.