From: Brendan Hansen Date: Wed, 14 Dec 2022 16:04:15 +0000 (-0600) Subject: added `!=` operator for `Pair` X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=4138bff0f041937c521c0cd1a86468b10a142893;p=onyx.git added `!=` operator for `Pair` --- diff --git a/core/container/pair.onyx b/core/container/pair.onyx index 1b043660..4f58608c 100644 --- a/core/container/pair.onyx +++ b/core/container/pair.onyx @@ -36,6 +36,10 @@ core.hash.to_u32 :: (p: Pair($First_Type/hash.Hashable, $Second_Type/hash.Hashab return p1.first == p2.first && p1.second == p2.second; } +#operator != (p1, p2: Pair($First_Type/Equatable, $Second_Type/Equatable)) => { + return !(p1.first == p2.first) || !(p1.second == p2.second); +} + #local Equatable :: interface (t: $T) { { t == t } -> bool; } \ No newline at end of file diff --git a/tests/bugs/autopoly_limits.onyx b/tests/bugs/autopoly_limits.onyx index 993cf022..945f37ac 100644 --- a/tests/bugs/autopoly_limits.onyx +++ b/tests/bugs/autopoly_limits.onyx @@ -1,6 +1,6 @@ use core -f :: (ctx) => { +f :: ctx => { x, y := 123, 456.0f; if ctx.a > 0 { return Pair.make(x, y), false; @@ -17,4 +17,4 @@ g :: (c: $Ctx, f: (Ctx) -> ($T, bool)) -> T { main :: () { p := g(.{a = 10}, f); printf("{}\n", p); -} \ No newline at end of file +}