From ead1fdb0c2252ba9555f0766f95f4bc20e201585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaya=20G=C3=B6kalp?= Date: Sat, 13 Aug 2022 22:22:46 +0300 Subject: [PATCH] fix: Setting the contract ID in an abi cast to a storage access fails to compile (#2529) --- .../ast_node/expression/typed_expression_variant.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression_variant.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression_variant.rs index b7dbdcef8d3..08e32471199 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression_variant.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression_variant.rs @@ -99,7 +99,6 @@ pub enum TypedExpressionVariant { // this span may be used for errors in the future, although it is not right now. span: Span, }, - #[allow(dead_code)] StorageAccess(TypeCheckedStorageAccess), IntrinsicFunction(TypedIntrinsicFunctionKind), /// a zero-sized type-system-only compile-time thing that is used for constructing ABI casts. @@ -323,6 +322,7 @@ impl PartialEq for TypedExpressionVariant { }, ) => *l_exp == *r_exp && l_variant == r_variant, (Self::EnumTag { exp: l_exp }, Self::EnumTag { exp: r_exp }) => *l_exp == *r_exp, + (Self::StorageAccess(l_exp), Self::StorageAccess(r_exp)) => *l_exp == *r_exp, ( Self::WhileLoop { body: l_body, @@ -536,7 +536,7 @@ impl fmt::Display for TypedExpressionVariant { } /// Describes the full storage access including all the subfields -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct TypeCheckedStorageAccess { pub fields: Vec, pub(crate) ix: StateIndex, @@ -559,7 +559,7 @@ impl TypeCheckedStorageAccess { } /// Describes a single subfield access in the sequence when accessing a subfield within storage. -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct TypeCheckedStorageAccessDescriptor { pub name: Ident, pub(crate) type_id: TypeId,