Skip to content

Commit

Permalink
Merge pull request #619 from AleoHQ/implicit-groups
Browse files Browse the repository at this point in the history
[Feature] Implicit groups
  • Loading branch information
collinc97 committed Feb 4, 2021
2 parents 7919eaa + 431aca1 commit bd2bd1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions asg/src/expression/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
10 changes: 10 additions & 0 deletions asg/tests/pass/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,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");
Expand Down

0 comments on commit bd2bd1f

Please sign in to comment.