Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Add parser unit test for a no-arg call
Browse files Browse the repository at this point in the history
  • Loading branch information
alxkzmn committed Aug 26, 2024
1 parent eef6836 commit 49fb609
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,18 @@ mod test {

assert!(result.is_ok());

// TODO should no-arg calls be allowed?
let circuit = "
machine caller (signal n) (signal b: field) {
smth <== a() -> final;
}
";

let debug_sym_ref_factory = DebugSymRefFactory::new("", circuit);
let result = TLDeclsParser::new().parse(&debug_sym_ref_factory, circuit);

assert!(result.is_ok());

// Wrong transition operator
let circuit = "
machine caller (signal n) (signal b: field) {
Expand Down
5 changes: 4 additions & 1 deletion src/parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ pub fn build_hyper_transition<F>(
state: Identifier,
call: Statement<F, Identifier>,
) -> Statement<F, Identifier> {
Statement::HyperTransition(dsym, state, Box::new(call))
match call {
Statement::Call(_, _, _, _) => Statement::HyperTransition(dsym, state, Box::new(call)),
_ => unreachable!("Hyper transition must include a call statement"),
}
}

0 comments on commit 49fb609

Please sign in to comment.