From 908271014a095c2fc2e49b2397df7317e9299cc4 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 21 Aug 2024 16:22:43 +0800 Subject: [PATCH] [core] typecheck/magic_methods: Add equality methods to string --- nac3core/src/typecheck/magic_methods.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nac3core/src/typecheck/magic_methods.rs b/nac3core/src/typecheck/magic_methods.rs index b5a0608c5..325f837a3 100644 --- a/nac3core/src/typecheck/magic_methods.rs +++ b/nac3core/src/typecheck/magic_methods.rs @@ -680,6 +680,7 @@ pub fn set_primitives_magic_methods(store: &PrimitiveStore, unifier: &mut Unifie bool: bool_t, uint32: uint32_t, uint64: uint64_t, + str: str_t, list: list_t, ndarray: ndarray_t, .. @@ -725,6 +726,9 @@ pub fn set_primitives_magic_methods(store: &PrimitiveStore, unifier: &mut Unifie impl_sign(unifier, store, bool_t, Some(int32_t)); impl_eq(unifier, store, bool_t, &[bool_t, ndarray_bool_t], None); + /* str ========= */ + impl_cmpop(unifier, store, str_t, &[str_t], &[Cmpop::Eq, Cmpop::NotEq], Some(bool_t)); + /* list ======== */ impl_binop(unifier, store, list_t, &[list_t], Some(list_t), &[Operator::Add]); impl_binop(unifier, store, list_t, &[int32_t, int64_t], Some(list_t), &[Operator::Mult]);