From 985cde0c2f2b7b0d6d16e67b55b00a2f58fc4bc8 Mon Sep 17 00:00:00 2001 From: Mohammad Fawaz Date: Tue, 4 Apr 2023 17:15:37 -0400 Subject: [PATCH] - Renamed `StorageHandle` to `StorageKey` as per the RFC - Remove support for type ascription on `self` for now - Instead, we now do `impl StorageKey>` which seems to work just as well --- sway-ast/src/item/mod.rs | 1 - .../language/parsed/declaration/function.rs | 6 -- .../ast_node/declaration/declaration.rs | 97 +++---------------- .../function/function_parameter.rs | 38 +------- .../ast_node/expression/typed_expression.rs | 39 ++++---- .../to_parsed_lang/convert_parse_tree.rs | 9 +- sway-error/src/error.rs | 3 - sway-lib-core/src/experimental/storage.sw | 2 +- sway-lib-std/src/experimental/storage.sw | 34 +++---- sway-lsp/src/traverse/lexed_tree.rs | 1 - sway-parse/src/item/mod.rs | 52 ++-------- swayfmt/src/items/item_fn/mod.rs | 35 +------ test/src/sdk-harness/test_projects/harness.rs | 8 +- 13 files changed, 65 insertions(+), 260 deletions(-) diff --git a/sway-ast/src/item/mod.rs b/sway-ast/src/item/mod.rs index 8dd37101a0e..f4c744ac564 100644 --- a/sway-ast/src/item/mod.rs +++ b/sway-ast/src/item/mod.rs @@ -79,7 +79,6 @@ pub enum FnArgs { self_token: SelfToken, ref_self: Option, mutable_self: Option, - ty: Option<(ColonToken, Ty)>, args_opt: Option<(CommaToken, Punctuated)>, }, } diff --git a/sway-core/src/language/parsed/declaration/function.rs b/sway-core/src/language/parsed/declaration/function.rs index f65599df3a9..2d4d2e5c3d0 100644 --- a/sway-core/src/language/parsed/declaration/function.rs +++ b/sway-core/src/language/parsed/declaration/function.rs @@ -40,12 +40,6 @@ impl PartialEqWithEngines for FunctionParameter { } } -impl FunctionParameter { - pub fn is_self(&self) -> bool { - self.name.as_str() == "self" - } -} - impl FunctionDeclaration { /// Checks if this `FunctionDeclaration` is a test. pub(crate) fn is_test(&self) -> bool { diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs b/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs index 6a077179282..509043a8764 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs @@ -3,14 +3,12 @@ use sway_types::{Named, Spanned}; use crate::{ decl_engine::{DeclEngineInsert, DeclRef, ReplaceFunctionImplementingType}, error::*, - language::{parsed, ty, ty::TyImplItem}, + language::{parsed, ty}, semantic_analysis::TypeCheckContext, type_system::*, CompileResult, }; -use std::collections::{BTreeMap, HashSet}; - impl ty::TyDecl { pub(crate) fn type_check( mut ctx: TypeCheckContext, @@ -197,7 +195,6 @@ impl ty::TyDecl { warnings, errors ); - let impl_trait_decl: ty::TyDecl = decl_engine.insert(impl_trait.clone()).into(); impl_trait.items.iter_mut().for_each(|item| { item.replace_implementing_type(engines, impl_trait_decl.clone()); @@ -212,84 +209,20 @@ impl ty::TyDecl { warnings, errors ); - - // Set of all type IDs that have corresponding items implemented for them in this - // `impl` block. In most cases, this is a single type ID that is equal to - // `impl_trait.implementing_for.type_id`. - let mut processed_ids = HashSet::new(); - - // This is a map from type IDs to a vector of impl items. In most cases, all the - // items are available to `impl_trait.implementing_for.type_id` (i.e. `Self`). - // However, there are situations where `self`, in some of the impl methods, has a - // type ascription that is different from `Self`. In that case, we have to keep - // track of which impl items are available to which type ID. - // - // For now, only `std::core::experimental::StorageHandle` is allowed as a type - // ascription for `self`, so check that here as well - let type_id_to_impl_items: BTreeMap> = impl_trait - .items - .iter() - .map(|item| match item { - TyImplItem::Fn(func) => { - // For function items, check if the first argument is `self`. If so, - // map the corresponding type ID to this item. Make sure that type IDs - // that are subset of each other are uniqued using `processed_ids`. - let func = decl_engine.get_function(func); - ( - match func.parameters.first() { - Some(first_arg) if first_arg.is_self() => { - let self_type_id = first_arg.type_argument.type_id; - match processed_ids.iter().find(|p| { - type_engine - .get(self_type_id) - .is_subset_of(&type_engine.get(**p), engines) - }) { - Some(id) => *id, - _ => { - processed_ids.insert(self_type_id); - self_type_id - } - } - } - _ => impl_trait.implementing_for.type_id, - }, - item, - ) - } - _ => { - // Other items are only available for `Self` - (impl_trait.implementing_for.type_id, item) - } - }) - .fold( - BTreeMap::new(), - |mut acc: BTreeMap>, (type_id, item)| { - acc.entry(type_id) - .and_modify(|v| v.push(item.clone())) - .or_insert(vec![item.clone()]); - acc - }, - ); - - // For each type ID discovered in type_id_to_impl_items, insert the collected items - // into the trait map - for type_id in type_id_to_impl_items.keys() { - check!( - ctx.namespace.insert_trait_implementation( - impl_trait.trait_name.clone(), - impl_trait.trait_type_arguments.clone(), - *type_id, - &type_id_to_impl_items[type_id], - &impl_trait.span, - true, - engines, - ), - return err(warnings, errors), - warnings, - errors - ); - } - + check!( + ctx.namespace.insert_trait_implementation( + impl_trait.trait_name.clone(), + impl_trait.trait_type_arguments.clone(), + impl_trait.implementing_for.type_id, + &impl_trait.items, + &impl_trait.span, + true, + engines, + ), + return err(warnings, errors), + warnings, + errors + ); let impl_trait_decl: ty::TyDecl = decl_engine.insert(impl_trait.clone()).into(); impl_trait.items.iter_mut().for_each(|item| { item.replace_implementing_type(engines, impl_trait_decl.clone()) diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/function/function_parameter.rs b/sway-core/src/semantic_analysis/ast_node/declaration/function/function_parameter.rs index 28dcd827721..af1011e16d3 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/function/function_parameter.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/function/function_parameter.rs @@ -7,7 +7,7 @@ use crate::{ }; use sway_error::error::CompileError; -use sway_types::{Ident, Spanned}; +use sway_types::Spanned; impl ty::TyFunctionParameter { pub(crate) fn type_check( @@ -21,8 +21,6 @@ impl ty::TyFunctionParameter { let type_engine = ctx.type_engine; let decl_engine = ctx.decl_engine; - let is_self = parameter.is_self(); - let FunctionParameter { name, is_reference, @@ -31,9 +29,6 @@ impl ty::TyFunctionParameter { mut type_argument, } = parameter; - let is_self_and_is_ascribed = - is_self && !matches!(type_engine.get(type_argument.type_id), TypeInfo::SelfType); - type_argument.type_id = check!( ctx.resolve_type_with_self( type_argument.type_id, @@ -46,37 +41,6 @@ impl ty::TyFunctionParameter { errors, ); - // If this parameter is `self` and if it is type ascribed, then check that the type - // ascribed is `core::experimental::storage::StorageHandle`. Otherwise, emit an error. In - // the future, we may want to allow more types such as `Self`. - if is_self_and_is_ascribed { - match type_engine.get(type_argument.type_id) { - TypeInfo::Struct(decl_ref) => { - let struct_decl = decl_engine.get_struct(&decl_ref); - if !(struct_decl.call_path.prefixes - == vec![ - Ident::new_no_span("core".into()), - Ident::new_no_span("experimental".into()), - Ident::new_no_span("storage".into()), - ] - && struct_decl.call_path.suffix - == Ident::new_no_span("StorageHandle".into())) - { - errors.push(CompileError::InvalidSelfParamterType { - r#type: ctx.engines().help_out(type_argument.type_id).to_string(), - span: name.span(), - }); - } - } - _ => { - errors.push(CompileError::InvalidSelfParamterType { - r#type: ctx.engines().help_out(type_argument.type_id).to_string(), - span: name.span(), - }); - } - } - } - if !is_from_method { let mutability = ty::VariableMutability::new_from_ref_mut(is_reference, is_mutable); if mutability == ty::VariableMutability::Mutable { diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs index cc6c3626caa..1700a6c31da 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs @@ -911,36 +911,34 @@ impl ty::TyExpression { ); if ctx.experimental_storage_enabled() { - // The type of a storage access is `core::experimental::StorageHandle`. This is the - // path to it. - let storage_handle_mod_path = vec![ + // The type of a storage access is `core::experimental::storage::StorageKey`. This is + // the path to it. + let storage_key_mod_path = vec![ Ident::new_with_override("core".into(), span.clone()), Ident::new_with_override("experimental".into(), span.clone()), Ident::new_with_override("storage".into(), span.clone()), ]; - let storage_handle_ident = - Ident::new_with_override("StorageHandle".into(), span.clone()); + let storage_key_ident = Ident::new_with_override("StorageKey".into(), span.clone()); // Search for the struct declaration with the call path above. - let storage_handle_decl_opt = check!( + let storage_key_decl_opt = check!( ctx.namespace .root() - .resolve_symbol(&storage_handle_mod_path, &storage_handle_ident), + .resolve_symbol(&storage_key_mod_path, &storage_key_ident), return err(warnings, errors), warnings, errors ); - let storage_handle_struct_decl_ref = check!( - storage_handle_decl_opt.to_struct_ref(engines), + let storage_key_struct_decl_ref = check!( + storage_key_decl_opt.to_struct_ref(engines), return err(warnings, errors), warnings, errors ); - let mut storage_handle_struct_decl = - decl_engine.get_struct(&storage_handle_struct_decl_ref); + let mut storage_key_struct_decl = decl_engine.get_struct(&storage_key_struct_decl_ref); - // Set the type arguments to `StorageHandle` to the `access_type`, which is represents - // the type of the data that the `StorageHandle` "points" to. + // Set the type arguments to `StorageKey` to the `access_type`, which is represents the + // type of the data that the `StorageKey` "points" to. let mut type_arguments = vec![TypeArgument { initial_type_id: access_type, type_id: access_type, @@ -948,11 +946,11 @@ impl ty::TyExpression { call_path_tree: None, }]; - // Monomorphize the generic `StorageHandle` type given the type argument specified above + // Monomorphize the generic `StorageKey` type given the type argument specified above let mut ctx = ctx; check!( ctx.monomorphize( - &mut storage_handle_struct_decl, + &mut storage_key_struct_decl, &mut type_arguments, EnforceTypeArguments::Yes, span @@ -964,14 +962,11 @@ impl ty::TyExpression { // Update `access_type` to be the type of the monomorphized struct after inserting it // into the type engine - let storage_handle_struct_decl_ref = - ctx.engines().de().insert(storage_handle_struct_decl); - access_type = type_engine.insert( - decl_engine, - TypeInfo::Struct(storage_handle_struct_decl_ref), - ); + let storage_key_struct_decl_ref = ctx.engines().de().insert(storage_key_struct_decl); + access_type = + type_engine.insert(decl_engine, TypeInfo::Struct(storage_key_struct_decl_ref)); - // take any trait items that apply to `StorageHandle` and copy them to the + // take any trait items that apply to `StorageKey` and copy them to the // monomorphized type ctx.namespace .insert_trait_implementation_for_type(engines, access_type); 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 b83c2881f21..8292430efba 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 @@ -1139,7 +1139,6 @@ fn fn_args_to_function_parameters( self_token, ref_self, mutable_self, - ty, args_opt, } => { let mutability_span = match (&ref_self, &mutable_self) { @@ -1148,13 +1147,7 @@ fn fn_args_to_function_parameters( (Some(reference), None) => reference.span(), (Some(reference), Some(mutable)) => Span::join(reference.span(), mutable.span()), }; - let type_id = match ty { - None => engines.te().insert(engines.de(), TypeInfo::SelfType), - Some(ty) => engines.te().insert( - engines.de(), - ty_to_type_info(context, handler, engines, ty.1)?, - ), - }; + let type_id = engines.te().insert(engines.de(), TypeInfo::SelfType); let mut function_parameters = vec![FunctionParameter { name: Ident::new(self_token.span()), is_reference: ref_self.is_some(), diff --git a/sway-error/src/error.rs b/sway-error/src/error.rs index 8031b1e4557..4d0c2485a09 100644 --- a/sway-error/src/error.rs +++ b/sway-error/src/error.rs @@ -633,8 +633,6 @@ pub enum CompileError { ConfigurableInLibrary { span: Span }, #[error("The name `{name}` is defined multiple times")] NameDefinedMultipleTimes { name: String, span: Span }, - #[error("invalid `self` parameter type: {r#type}")] - InvalidSelfParamterType { r#type: String, span: Span }, } impl std::convert::From for CompileError { @@ -805,7 +803,6 @@ impl Spanned for CompileError { TraitImplPayabilityMismatch { span, .. } => span.clone(), ConfigurableInLibrary { span } => span.clone(), NameDefinedMultipleTimes { span, .. } => span.clone(), - InvalidSelfParamterType { span, .. } => span.clone(), } } } diff --git a/sway-lib-core/src/experimental/storage.sw b/sway-lib-core/src/experimental/storage.sw index 6c49e3ffeec..e6af5596df0 100644 --- a/sway-lib-core/src/experimental/storage.sw +++ b/sway-lib-core/src/experimental/storage.sw @@ -3,7 +3,7 @@ library; /// Describes a location in storage specified by the `b256` key of a particular storage slot and an /// offset, in words, from the start of the storage slot at `key`. The parameter `T` is the type of /// the data to be read from or written to at `offset`. -pub struct StorageHandle { +pub struct StorageKey { key: b256, offset: u64, } diff --git a/sway-lib-std/src/experimental/storage.sw b/sway-lib-std/src/experimental/storage.sw index 7903efc1e72..0867dff29c1 100644 --- a/sway-lib-std/src/experimental/storage.sw +++ b/sway-lib-std/src/experimental/storage.sw @@ -3,7 +3,7 @@ library; use ::alloc::{alloc, realloc_bytes}; use ::hash::sha256; use ::option::Option; -use core::experimental::storage::StorageHandle; +use core::experimental::storage::StorageKey; /// Store a stack value in storage. Will not work for heap values. /// @@ -49,8 +49,8 @@ pub fn write(key: b256, offset: u64, value: T) { /// Reads a value of type `T` starting at the location specified by `key` and `offset`. If the /// value crosses the boundary of a storage slot, reading continues at the following slot. /// -/// Returns `Option(value)` if a the storage slots read were valid and contain `value`. -/// Otherwise, return `None`. +/// Returns `Option(value)` if the storage slots read were valid and contain `value`. Otherwise, +/// return `None`. /// /// ### Arguments /// @@ -112,7 +112,7 @@ pub fn clear(key: b256) -> bool { __state_clear(key, number_of_slots) } -impl StorageHandle { +impl StorageKey { /// Reads a value of type `T` starting at the location specified by `self`. If the value /// crosses the boundary of a storage slot, reading continues at the following slot. /// @@ -127,13 +127,13 @@ impl StorageHandle { /// /// ```sway /// fn foo() { - /// let r: StorageHandle = StorageHandle { + /// let r: StorageKey = StorageKey { /// key: 0x0000000000000000000000000000000000000000000000000000000000000000, /// offset: 2, /// }; /// /// // Reads the third word from storage slot with key 0x000...0 - /// let x:u64 = r.read(); + /// let x: u64 = r.read(); /// } /// ``` #[storage(read)] @@ -144,7 +144,7 @@ impl StorageHandle { /// Reads a value of type `T` starting at the location specified by `self`. If the value /// crosses the boundary of a storage slot, reading continues at the following slot. /// - /// Returns `Option(value)` if a the storage slots read were valid and contain `value`. + /// Returns `Some(value)` if a the storage slots read were valid and contain `value`. /// Otherwise, return `None`. /// /// ### Arguments @@ -155,13 +155,13 @@ impl StorageHandle { /// /// ```sway /// fn foo() { - /// let r: StorageHandle = StorageHandle { + /// let r: StorageKey = StorageKey { /// key: 0x0000000000000000000000000000000000000000000000000000000000000000, /// offset: 2, /// }; /// /// // Reads the third word from storage slot with key 0x000...0 - /// let x:Option = r.try_read(); + /// let x: Option = r.try_read(); /// } /// ``` #[storage(read)] @@ -180,7 +180,7 @@ impl StorageHandle { /// /// ```sway /// fn foo() { - /// let r: StorageHandle = StorageHandle { + /// let r: StorageKey = StorageKey { /// key: 0x0000000000000000000000000000000000000000000000000000000000000000, /// offset: 2, /// }; @@ -196,7 +196,7 @@ impl StorageHandle { /// A persistent key-value pair mapping struct. pub struct StorageMap {} -impl StorageMap { +impl StorageKey> { /// Inserts a key-value pair into the map. /// /// ### Arguments @@ -215,17 +215,17 @@ impl StorageMap { /// let key = 5_u64; /// let value = true; /// storage.map.insert(key, value); - /// let retrieved_value = storage.map.get(key); + /// let retrieved_value = storage.map.get(key).read(); /// assert(value == retrieved_value); /// } /// ``` #[storage(read, write)] - pub fn insert(self: StorageHandle, key: K, value: V) { + pub fn insert(self, key: K, value: V) { let key = sha256((key, self.key)); write::(key, 0, value); } - /// Retrieves the `StorageHandle` that describes the raw location in storage of the value + /// Retrieves the `StorageKey` that describes the raw location in storage of the value /// stored at `key`, regardless of whether a value is actually stored at that location or not. /// /// ### Arguments @@ -248,8 +248,8 @@ impl StorageMap { /// } /// ``` #[storage(read)] - pub fn get(self: StorageHandle, key: K) -> StorageHandle { - StorageHandle { + pub fn get(self, key: K) -> StorageKey { + StorageKey { key: sha256((key, self.key)), offset: 0, } @@ -280,7 +280,7 @@ impl StorageMap { /// } /// ``` #[storage(write)] - pub fn remove(self: StorageHandle, key: K) -> bool { + pub fn remove(self, key: K) -> bool { let key = sha256((key, self.key)); clear::(key) } diff --git a/sway-lsp/src/traverse/lexed_tree.rs b/sway-lsp/src/traverse/lexed_tree.rs index fc5b842184e..6a0cb92002f 100644 --- a/sway-lsp/src/traverse/lexed_tree.rs +++ b/sway-lsp/src/traverse/lexed_tree.rs @@ -495,7 +495,6 @@ impl Parse for FnArgs { ref_self, mutable_self, args_opt, - .. } => { insert_keyword(ctx, self_token.span()); if let Some(ref_token) = ref_self { diff --git a/sway-parse/src/item/mod.rs b/sway-parse/src/item/mod.rs index 0ff85c905b3..75c715dc5a2 100644 --- a/sway-parse/src/item/mod.rs +++ b/sway-parse/src/item/mod.rs @@ -1,9 +1,9 @@ use crate::{Parse, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::keywords::{ - AbiToken, ClassToken, ColonToken, CommaToken, ConfigurableToken, ConstToken, EnumToken, - FnToken, ImplToken, ModToken, MutToken, OpenAngleBracketToken, RefToken, SelfToken, - SemicolonToken, StorageToken, StructToken, TraitToken, TypeToken, UseToken, WhereToken, + AbiToken, ClassToken, ConfigurableToken, ConstToken, EnumToken, FnToken, ImplToken, ModToken, + MutToken, OpenAngleBracketToken, RefToken, SelfToken, SemicolonToken, StorageToken, + StructToken, TraitToken, TypeToken, UseToken, WhereToken, }; use sway_ast::{ FnArg, FnArgs, FnSignature, ItemConst, ItemEnum, ItemFn, ItemKind, ItemStruct, ItemTrait, @@ -101,59 +101,22 @@ impl ParseToEnd for FnArgs { } match parser.take() { Some(self_token) => { - match (parser.peek::(), parser.peek::()) { - (Some(_), None) => { - // Found `:`, now expect a type - let colon_token = parser.parse()?; - let ty = parser.parse()?; - match parser.take() { - Some(comma_token) => { - let (args, consumed) = parser.parse_to_end()?; - let fn_args = FnArgs::NonStatic { - self_token, - ref_self, - mutable_self, - ty: Some((colon_token, ty)), - args_opt: Some((comma_token, args)), - }; - Ok((fn_args, consumed)) - } - None => { - let fn_args = FnArgs::NonStatic { - self_token, - ref_self, - mutable_self, - ty: Some((colon_token, ty)), - args_opt: None, - }; - match parser.check_empty() { - Some(consumed) => Ok((fn_args, consumed)), - None => Err(parser.emit_error( - ParseErrorKind::ExpectedCommaOrCloseParenInFnArgs, - )), - } - } - } - } - (None, Some(_)) => { - // Found `,`, expect the other arguments - let comma_token = parser.parse::()?; + match parser.take() { + Some(comma_token) => { let (args, consumed) = parser.parse_to_end()?; let fn_args = FnArgs::NonStatic { self_token, ref_self, mutable_self, - ty: None, args_opt: Some((comma_token, args)), }; Ok((fn_args, consumed)) } - (None, None) => { + None => { let fn_args = FnArgs::NonStatic { self_token, ref_self, mutable_self, - ty: None, args_opt: None, }; match parser.check_empty() { @@ -162,9 +125,6 @@ impl ParseToEnd for FnArgs { .emit_error(ParseErrorKind::ExpectedCommaOrCloseParenInFnArgs)), } } - (Some(_), Some(_)) => { - unreachable!("Impossible to peek into a comma and a colon simultaneously!") - } } } None => { diff --git a/swayfmt/src/items/item_fn/mod.rs b/swayfmt/src/items/item_fn/mod.rs index 0cbf6197b80..0c69453bd39 100644 --- a/swayfmt/src/items/item_fn/mod.rs +++ b/swayfmt/src/items/item_fn/mod.rs @@ -12,9 +12,8 @@ use crate::{ }; use std::fmt::Write; use sway_ast::{ - keywords::{ColonToken, MutToken, RefToken, SelfToken, Token}, + keywords::{MutToken, RefToken, SelfToken, Token}, token::Delimiter, - ty::Ty, FnArg, FnArgs, FnSignature, ItemFn, }; use sway_types::Spanned; @@ -222,8 +221,6 @@ fn format_fn_args( ref_self, mutable_self, args_opt, - ty, - .. } => { match formatter.shape.code_line.line_style { LineStyle::Multiline => { @@ -233,14 +230,7 @@ fn format_fn_args( "\n{}", formatter.shape.indent.to_string(&formatter.config)? )?; - format_self( - self_token, - ref_self, - mutable_self, - ty, - formatted_code, - formatter, - )?; + format_self(self_token, ref_self, mutable_self, formatted_code)?; // `args_opt` if let Some((comma, args)) = args_opt { // `, ` @@ -250,14 +240,7 @@ fn format_fn_args( } } _ => { - format_self( - self_token, - ref_self, - mutable_self, - ty, - formatted_code, - formatter, - )?; + format_self(self_token, ref_self, mutable_self, formatted_code)?; // `args_opt` if let Some((comma, args)) = args_opt { // `, ` @@ -277,9 +260,7 @@ fn format_self( self_token: &SelfToken, ref_self: &Option, mutable_self: &Option, - ty: &Option<(ColonToken, Ty)>, formatted_code: &mut FormattedCode, - formatter: &mut Formatter, ) -> Result<(), FormatterError> { // `ref ` if let Some(ref_token) = ref_self { @@ -292,15 +273,6 @@ fn format_self( // `self` write!(formatted_code, "{}", self_token.span().as_str())?; - // Type ascription - if let Some((colon_token, ty)) = ty { - // `: ` - write!(formatted_code, "{} ", colon_token.span().as_str())?; - - // `Ty` - ty.format(formatted_code, formatter)? - } - Ok(()) } @@ -388,7 +360,6 @@ impl LeafSpans for FnArgs { ref_self, mutable_self, args_opt, - .. } => { collected_spans.push(ByteSpan::from(self_token.span())); if let Some(reference) = ref_self { diff --git a/test/src/sdk-harness/test_projects/harness.rs b/test/src/sdk-harness/test_projects/harness.rs index b6561fbfd91..dfc1e94f560 100644 --- a/test/src/sdk-harness/test_projects/harness.rs +++ b/test/src/sdk-harness/test_projects/harness.rs @@ -1,6 +1,6 @@ // Add test modules here: -/*mod auth; +mod auth; mod block; mod call_frames; mod configurables_in_contract; @@ -10,9 +10,9 @@ mod contract_bytecode; mod ec_recover; mod ec_recover_and_match_predicate; mod evm; -mod evm_ec_recover;*/ +mod evm_ec_recover; mod experimental_storage; -/*mod experimental_storage_init; +mod experimental_storage_init; mod experimental_storage_map; mod exponentiation; mod generics_in_abi; @@ -36,4 +36,4 @@ mod storage_vec; mod token_ops; mod tx_fields; mod type_aliases; -mod vec_in_abi;*/ +mod vec_in_abi;