mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-25 18:42:26 +03:00
fix field/group addition
This commit is contained in:
parent
20a046bbbb
commit
198230d604
@ -134,10 +134,12 @@ impl FromAst<leo_ast::BinaryExpression> for BinaryExpression {
|
||||
},
|
||||
BinaryOperationClass::Numeric => match expected_type {
|
||||
Some(x @ PartialType::Integer(_, _)) => Some(x),
|
||||
Some(x @ PartialType::Type(Type::Field)) => Some(x),
|
||||
Some(x @ PartialType::Type(Type::Group)) => Some(x),
|
||||
Some(x) => {
|
||||
return Err(AsgConvertError::unexpected_type(
|
||||
&x.to_string(),
|
||||
Some("integer"),
|
||||
Some("integer, field, or group"),
|
||||
&value.span,
|
||||
));
|
||||
}
|
||||
|
@ -28,6 +28,16 @@ fn test_add() {
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add_explicit() {
|
||||
let program_string = r#"
|
||||
function main() {
|
||||
let c: field = 0field + 1field;
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
|
@ -104,6 +104,16 @@ fn test_add() {
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add_explicit() {
|
||||
let program_string = r#"
|
||||
function main() {
|
||||
let c: group = 0group + 1group;
|
||||
}
|
||||
"#;
|
||||
load_asg(program_string).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sub() {
|
||||
let program_string = include_str!("sub.leo");
|
||||
|
Loading…
Reference in New Issue
Block a user