Merge pull request #4558 from roc-lang/specialization-sets-for-impl-opaques

Support custom abilities for opaques with immaterial lambda sets
This commit is contained in:
Ayaz 2022-11-25 16:42:32 -06:00 committed by GitHub
commit 8c0ff4c839
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 108 additions and 4 deletions

View file

@ -1734,6 +1734,45 @@ mod eq {
)
}
#[test]
fn custom_eq_impl_for_fn_opaque() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [main] to "./platform"
Q := ({} -> Str) has [Eq {isEq: isEqQ}]
isEqQ = \@Q _, @Q _ -> Bool.true
main = isEqQ (@Q \{} -> "a") (@Q \{} -> "a")
"#
),
true,
bool
)
}
#[test]
#[ignore = "needs https://github.com/roc-lang/roc/issues/4557 first"]
fn custom_eq_impl_for_fn_opaque_material() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [main] to "./platform"
Q := ({} -> Str) has [Eq {isEq: isEqQ}]
isEqQ = \@Q f1, @Q f2 -> (f1 {} == f2 {})
main = isEqQ (@Q \{} -> "a") (@Q \{} -> "a")
"#
),
true,
bool
)
}
#[test]
fn derive_structural_eq() {
assert_evals_to!(