From a76f8e2164620cbfd628043e6967213c099d4997 Mon Sep 17 00:00:00 2001 From: IGI-111 Date: Fri, 19 Jul 2024 13:53:59 +0200 Subject: [PATCH] Remove support for namespace attribute (#6279) ## Description Namespace annotation is no longer supported and has been replaced by namespacing syntax. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --- examples/storage_namespace/src/main.sw | 5 +++-- .../transform/to_parsed_lang/convert_parse_tree.rs | 13 +++---------- sway-types/src/constants.rs | 2 -- .../test_projects/storage_namespace/src/main.sw | 1 - 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/examples/storage_namespace/src/main.sw b/examples/storage_namespace/src/main.sw index 40ddb1632a8..7adad8f5cbe 100644 --- a/examples/storage_namespace/src/main.sw +++ b/examples/storage_namespace/src/main.sw @@ -3,10 +3,11 @@ contract; use std::storage::storage_api::{read, write}; // ANCHOR: storage_namespace -#[namespace(example_namespace)] storage { + example_namespace { + foo: u64 = 0, + }, // ANCHOR_END: storage_namespace - foo: u64 = 0, } abi StorageNamespaceExample { diff --git a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs index 614b451e645..78ed08eee4e 100644 --- a/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs +++ b/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs @@ -34,9 +34,9 @@ use sway_types::{ ALLOW_ATTRIBUTE_NAME, CFG_ATTRIBUTE_NAME, CFG_EXPERIMENTAL_NEW_ENCODING, CFG_PROGRAM_TYPE_ARG_NAME, CFG_TARGET_ARG_NAME, DEPRECATED_ATTRIBUTE_NAME, DOC_ATTRIBUTE_NAME, DOC_COMMENT_ATTRIBUTE_NAME, FALLBACK_ATTRIBUTE_NAME, - INLINE_ATTRIBUTE_NAME, NAMESPACE_ATTRIBUTE_NAME, PAYABLE_ATTRIBUTE_NAME, - STORAGE_PURITY_ATTRIBUTE_NAME, STORAGE_PURITY_READ_NAME, STORAGE_PURITY_WRITE_NAME, - TEST_ATTRIBUTE_NAME, VALID_ATTRIBUTE_NAMES, + INLINE_ATTRIBUTE_NAME, PAYABLE_ATTRIBUTE_NAME, STORAGE_PURITY_ATTRIBUTE_NAME, + STORAGE_PURITY_READ_NAME, STORAGE_PURITY_WRITE_NAME, TEST_ATTRIBUTE_NAME, + VALID_ATTRIBUTE_NAMES, }, integer_bits::IntegerBits, BaseIdent, @@ -4698,13 +4698,6 @@ fn item_attrs_to_map( let attrs = attr_decl.attribute.get().into_iter(); for attr in attrs { let name = attr.name.as_str(); - if name == NAMESPACE_ATTRIBUTE_NAME { - handler.emit_warn(CompileWarning { - span: attr_decl.span().clone(), - warning_content: Warning::NamespaceAttributeDeprecated, - }); - continue; - } if !VALID_ATTRIBUTE_NAMES.contains(&name) { handler.emit_warn(CompileWarning { span: attr_decl.span().clone(), diff --git a/sway-types/src/constants.rs b/sway-types/src/constants.rs index 5cbbabe1d97..7d1cc136cef 100644 --- a/sway-types/src/constants.rs +++ b/sway-types/src/constants.rs @@ -53,8 +53,6 @@ pub const CFG_EXPERIMENTAL_NEW_ENCODING: &str = "experimental_new_encoding"; pub const DEPRECATED_ATTRIBUTE_NAME: &str = "deprecated"; -pub const NAMESPACE_ATTRIBUTE_NAME: &str = "namespace"; - pub const FALLBACK_ATTRIBUTE_NAME: &str = "fallback"; /// The list of valid attributes. diff --git a/test/src/sdk-harness/test_projects/storage_namespace/src/main.sw b/test/src/sdk-harness/test_projects/storage_namespace/src/main.sw index ba63209d76d..043ede1fb74 100644 --- a/test/src/sdk-harness/test_projects/storage_namespace/src/main.sw +++ b/test/src/sdk-harness/test_projects/storage_namespace/src/main.sw @@ -47,7 +47,6 @@ const S_13: b256 = 0x00000000000000000000000000000000000000000000000000000000000 const S_14: b256 = 0x0000000000000000000000000000000000000000000000000000000000000014; const S_15: b256 = 0x0000000000000000000000000000000000000000000000000000000000000015; -#[namespace(my_storage_namespace)] abi StorageTest { #[storage(read, write)] fn store_bool(value: bool);