From: Brendan Hansen Date: Sun, 18 Feb 2024 04:06:53 +0000 (-0600) Subject: fixed: weird issue with operator == for Optionals X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=d250a379d9d416b27ba05b079901688bc8bc02ab;p=onyx.git fixed: weird issue with operator == for Optionals --- diff --git a/core/container/optional.onyx b/core/container/optional.onyx index c94eb1a4..b6133e73 100644 --- a/core/container/optional.onyx +++ b/core/container/optional.onyx @@ -255,11 +255,11 @@ use core #operator == (o1, o2: ?$T) -> bool { if cast(Optional(T).tag_enum, o1) != cast(Optional(T).tag_enum, o2) do return false; + if o1.tag == .None do return true; - return switch o1 { - case .None => true; - case .Some as v1 => v1 == o2->unwrap(); - }; + v1 := o1->unwrap(); + v2 := o2->unwrap(); + return v1 == v2; } #operator ?? macro (opt: ?$T, default: T) -> T {