diff --git a/crates/aiken-lang/src/tests/check.rs b/crates/aiken-lang/src/tests/check.rs index 6556739b..d0da79ea 100644 --- a/crates/aiken-lang/src/tests/check.rs +++ b/crates/aiken-lang/src/tests/check.rs @@ -1859,6 +1859,29 @@ fn allow_expect_into_type_from_data_2() { assert!(check(parse(source_code)).is_ok()) } +#[test] +fn forbid_expect_from_arbitrary_type() { + let source_code = r#" + type Foo { + x: Int + } + + type Bar { + y: Int + } + + fn bar(f: Foo) { + expect b: Bar = f + Void + } + "#; + + assert!(matches!( + check(parse(source_code)), + Err((_, Error::CouldNotUnify { .. })) + )) +} + #[test] fn forbid_expect_into_opaque_type_constructor_without_typecasting_in_module() { let source_code = r#"