add extra regression test from stdlib.

Signed-off-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
KtorZ 2025-03-15 23:00:55 +01:00
parent 660ff7fa31
commit 983902fca8
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 36 additions and 0 deletions

View File

@ -2267,6 +2267,42 @@ fn allow_expect_into_opaque_type_constructor_without_typecasting_in_module() {
assert!(check(parse(source_code)).is_ok());
}
#[test]
fn use_imported_type_as_namespace_for_patterns() {
let dependency = r#"
pub type Credential {
VerificationKey(ByteArray)
Script(ByteArray)
}
"#;
let source_code = r#"
use cardano/address.{Credential, Script, VerificationKey}
pub fn compare(left: Credential, right: Credential) -> Ordering {
when left is {
Script(left) ->
when right is {
Script(right) -> Equal
_ -> Less
}
VerificationKey(left) ->
when right is {
Script(_) -> Greater
VerificationKey(right) -> Equal
}
}
}
"#;
let result = check_with_deps(
dbg!(parse(source_code)),
vec![(parse_as(dependency, "cardano/address"))],
);
assert!(matches!(result, Ok(..)), "{result:#?}");
}
#[test]
fn use_type_as_namespace_for_patterns() {
let dependency = r#"