Add extra test case.

This commit is contained in:
KtorZ
2024-03-21 16:13:06 +01:00
committed by Lucas
parent bee2b712de
commit dc9bab4f5c

View File

@@ -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#"