fix(check): only disallow ml_result in data

This commit is contained in:
rvcas
2024-02-29 11:19:26 -05:00
parent d18caaeecb
commit ff5491caa0
3 changed files with 29 additions and 2 deletions

View File

@@ -50,6 +50,33 @@ fn check_validator(
check_module(ast, ModuleKind::Validator)
}
#[test]
fn bls12_381_elements_in_data_type() {
let source_code = r#"
type Datum {
D0(G1Element)
D1(G2Element)
}
"#;
assert!(check(parse(source_code)).is_ok())
}
#[test]
fn bls12_381_ml_result_in_data_type() {
let source_code = r#"
type Datum {
thing: MillerLoopResult
}
"#;
let res = check(parse(source_code));
dbg!(&res);
assert!(matches!(res, Err((_, Error::IllegalTypeInData { .. }))))
}
#[test]
fn validator_illegal_return_type() {
let source_code = r#"