implicit groups

This commit is contained in:
Protryon 2021-02-04 07:57:04 -08:00
parent 90fc6a9c12
commit 431aca1f81
2 changed files with 15 additions and 0 deletions

View File

@ -173,6 +173,11 @@ impl FromAst<leo_ast::ValueExpression> for Constant {
span: Some(span.clone()),
value: ConstValue::Field(value.parse().map_err(|_| AsgConvertError::invalid_int(&value, span))?),
},
Some(PartialType::Type(Type::Group)) => Constant {
parent: RefCell::new(None),
span: Some(span.clone()),
value: ConstValue::Group(GroupValue::Single(value.to_string())),
},
Some(PartialType::Type(Type::Address)) => Constant {
parent: RefCell::new(None),
span: Some(span.clone()),

View File

@ -38,6 +38,16 @@ fn test_one() {
load_asg(program_string).unwrap();
}
#[test]
fn test_implicit() {
let program_string = r#"
function main() {
let element: group = 0;
}
"#;
load_asg(program_string).unwrap();
}
#[test]
fn test_zero() {
let program_string = include_str!("zero.leo");