added `!=` operator for `Pair`
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 14 Dec 2022 16:04:15 +0000 (10:04 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 14 Dec 2022 16:04:15 +0000 (10:04 -0600)
core/container/pair.onyx
tests/bugs/autopoly_limits.onyx

index 1b043660314ed7f872cb79432018639a7132f52a..4f58608c85dbcd995ff7bd16723602f5a30dbbb3 100644 (file)
@@ -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
index 993cf0222f027e29c8d8bf6d921b3e1630cbe1ea..945f37ac8a92c7c15e5f312d7d605448c683b4fb 100644 (file)
@@ -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
+}