mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
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:
commit
8c0ff4c839
5 changed files with 108 additions and 4 deletions
|
@ -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!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue