mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-26 11:45:00 +03:00
Merge pull request #654 from AleoHQ/field-group-fix
Fix field/group addition
This commit is contained in:
commit
29fa7cf19e
@ -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