From 9218b1f0e1e59ba349afde09c19d80dfb0d173ac Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Mon, 15 Sep 2025 13:23:13 -0300 Subject: [PATCH 01/11] Warning about Solidity future keywords --- liblangutil/Token.cpp | 33 ++++++++++++++++++++ liblangutil/Token.h | 6 ++++ libsolidity/analysis/NameAndTypeResolver.cpp | 14 +++++++++ libsolidity/analysis/SyntaxChecker.cpp | 1 + 4 files changed, 54 insertions(+) diff --git a/liblangutil/Token.cpp b/liblangutil/Token.cpp index 1c5ae6f4e707..451412b0d5c2 100644 --- a/liblangutil/Token.cpp +++ b/liblangutil/Token.cpp @@ -152,6 +152,39 @@ bool isYulKeyword(std::string_view const _literal) return _literal == "leave" || isYulKeyword(keywordByName(_literal)); } +bool isFutureSolidityKeyword(std::string const& _literal) +{ + std::set const futureSolidityKeywords = { + "transient", + "layout", + "at", + "error", + "super", + "this" + }; + return futureSolidityKeywords.contains(_literal); +} + +bool isFutureYulKeyword(std::string const& _literal) +{ + return _literal == "leave"; +} + +bool isFutureYulReservedIdentifier(std::string const& _literal) +{ + std::set futureReservedIdentifier = { + "basefee", + "blobbasefee", + "blobhash", + "mcopy", + "memoryguard", + "prevrandao", + "tload", + "tstore", + }; + return futureReservedIdentifier.contains(_literal); +} + std::tuple fromIdentifierOrKeyword(std::string const& _literal) { // Used for `bytesM`, `uintM`, `intM`, `fixedMxN`, `ufixedMxN`. diff --git a/liblangutil/Token.h b/liblangutil/Token.h index bfbc89bb4839..0b5b6905a720 100644 --- a/liblangutil/Token.h +++ b/liblangutil/Token.h @@ -379,6 +379,12 @@ namespace TokenTraits bool isYulKeyword(std::string_view _literal); + bool isFutureSolidityKeyword(std::string const& _literal); + + bool isFutureYulKeyword(std::string const& _literal); + + bool isFutureYulReservedIdentifier(std::string const& _literal); + Token AssignmentToBinaryOp(Token op); // @returns the precedence > 0 for binary and compare diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 2d55b46fc9f7..eb808c288f09 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -561,6 +561,20 @@ bool DeclarationRegistrationHelper::registerDeclaration( ); } + if ( + TokenTraits::isFutureSolidityKeyword(name) || + TokenTraits::isFutureYulKeyword(name) + ) + _errorReporter.warning( + 6335_error, + _declaration.location(), + fmt::format( + "\"{}\" will be promoted to keyword in the next breaking version" + " and will not be allowed as an identifier anymore.", + name + ) + ); + if (!_container.registerDeclaration(_declaration, _name, _errorLocation, !_declaration.isVisibleInContract() || _inactive, false)) { SourceLocation firstDeclarationLocation; diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index 9bf784b36573..ef82b3b33e95 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -409,6 +409,7 @@ bool SyntaxChecker::visit(ContractDefinition const& _contract) "Functions are not allowed to have the same name as the contract. " "If you intend this to be a constructor, use \"constructor(...) { ... }\" to define it." ); + return true; } From cb70bf4a7c8abe0cd12cbc61127520f86fc98bf4 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Tue, 23 Sep 2025 14:57:19 -0300 Subject: [PATCH 02/11] Update tests (Solidity keywords) --- .../constants/constant_state_variable_named_transient.sol | 1 + .../dataLocations/data_location_in_function_type_fail.sol | 1 + ...rgument_location_specifier_test_external_transient.sol | 1 + ...rgument_location_specifier_test_internal_transient.sol | 1 + .../library_function_with_data_location_transient.sol | 8 ++++++++ ...rgument_location_specifier_test_external_transient.sol | 1 + ...rgument_location_specifier_test_internal_transient.sol | 1 + .../private_function_parameters_location_transient.sol | 1 + ...vate_function_return_parameters_location_transient.sol | 1 + ..._argument_location_specifier_test_public_transient.sol | 1 + ...blic_function_return_parameters_location_transient.sol | 1 + .../dataLocations/transient_function_type_parameter.sol | 1 + .../duplicateFunctions/illegal_names_exception.sol | 2 ++ .../duplicateFunctions/illegal_names_functions.sol | 2 ++ test/libsolidity/syntaxTests/enums/illegal_names.sol | 4 ++++ .../syntaxTests/events/illegal_names_exception.sol | 2 ++ .../events/illegal_names_exception_file_level.sol | 3 +++ .../syntaxTests/freeFunctions/illegal_names.sol | 2 ++ .../functionTypes/function_type_with_transient_param.sol | 2 ++ test/libsolidity/syntaxTests/immutable/illegal_names.sol | 2 ++ .../immutable/immutable_state_var_named_transient.sol | 1 + .../syntaxTests/modifiers/transient_parameter.sol | 1 + .../shadowsBuiltin/illegal_names_function_parameters.sol | 4 ++++ .../shadowsBuiltin/illegal_names_library_using_for.sol | 2 ++ .../nameAndTypeResolution/shadowsBuiltin/this_super.sol | 2 ++ .../syntaxTests/parsing/contract_named_transient.sol | 2 ++ .../storageLayoutSpecifier/contract_named_at.sol | 1 + .../storageLayoutSpecifier/contract_named_layout.sol | 1 + .../contract_with_members_named_layout_and_at.sol | 2 ++ .../storageLayoutSpecifier/hex_string_cast.sol | 4 ++-- .../syntaxTests/storageLayoutSpecifier/literal_cast.sol | 4 ++-- .../syntaxTests/storageLayoutSpecifier/type_uint_max.sol | 4 ++-- .../libsolidity/syntaxTests/unusedVariables/try_catch.sol | 1 + .../syntaxTests/variableDeclaration/illegal_names.sol | 6 ++++++ .../variableDeclaration/transient_as_identifier.sol | 8 ++++++++ 35 files changed, 75 insertions(+), 6 deletions(-) diff --git a/test/libsolidity/syntaxTests/constants/constant_state_variable_named_transient.sol b/test/libsolidity/syntaxTests/constants/constant_state_variable_named_transient.sol index 4d9873d36d07..341af7301603 100644 --- a/test/libsolidity/syntaxTests/constants/constant_state_variable_named_transient.sol +++ b/test/libsolidity/syntaxTests/constants/constant_state_variable_named_transient.sol @@ -2,3 +2,4 @@ contract C { int constant public transient = 0; } // ---- +// Warning 6335: (17-50): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol index cd46b15b0716..340fc9c6b0b3 100644 --- a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol +++ b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol @@ -7,5 +7,6 @@ library L { // ---- // Warning 6162: (251-267): Naming function type parameters is deprecated. +// Warning 6335: (251-267): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (159-173): Data location must be "memory" or "calldata" for parameter in function, but "storage" was given. // TypeError 6651: (251-267): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_transient.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_transient.sol index 98fbb2d5ee66..a2988568ba2b 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_transient.sol @@ -2,4 +2,5 @@ contract test { function f(bytes transient) external; } // ---- +// Warning 6335: (31-46): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (31-46): Data location must be "memory" or "calldata" for parameter in external function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_transient.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_transient.sol index 4a5b6f999d86..cfa6900cb472 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_transient.sol @@ -2,4 +2,5 @@ contract test { function f(bytes transient) internal {} } // ---- +// Warning 6335: (31-46): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (31-46): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_transient.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_transient.sol index 75253342c4e0..deb208084b82 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_transient.sol @@ -9,6 +9,14 @@ library L { function i2() external pure returns (uint[] transient) { } } // ---- +// Warning 6335: (28-44): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (103-119): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (141-157): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (218-234): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (256-272): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (329-345): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (367-383): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (444-460): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (28-44): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. // TypeError 6651: (103-119): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. // TypeError 6651: (141-157): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_transient.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_transient.sol index 1dcedf49adcf..8e70f9389d01 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_transient.sol @@ -2,4 +2,5 @@ library test { function f(bytes transient) external {} } // ---- +// Warning 6335: (30-45): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (30-45): Data location must be "storage", "memory" or "calldata" for parameter in external function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_transient.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_transient.sol index d66fa7fadd2d..e0b4ee154ae5 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_transient.sol @@ -2,4 +2,5 @@ library test { function f(bytes transient) internal pure {} } // ---- +// Warning 6335: (30-45): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (30-45): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_location_transient.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_location_transient.sol index 750aa4fee522..3e6527a80858 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_location_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_location_transient.sol @@ -2,4 +2,5 @@ contract C { function f(uint[] transient) private pure {} } // ---- +// Warning 6335: (28-44): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (28-44): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_location_transient.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_location_transient.sol index d1bf8762480f..705035a0754c 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_location_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_location_transient.sol @@ -2,4 +2,5 @@ contract C { function f() private pure returns (uint[] transient) {} } // ---- +// Warning 6335: (52-68): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (52-68): Data location must be "storage", "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_transient.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_transient.sol index ce4f42f469e4..5f1d64874659 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_transient.sol @@ -2,4 +2,5 @@ contract test { function f(bytes transient) public; } // ---- +// Warning 6335: (31-46): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (31-46): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_location_transient.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_location_transient.sol index 862b7d236bfa..287e974affbb 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_location_transient.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_location_transient.sol @@ -2,4 +2,5 @@ contract C { function h() public pure returns(uint[] transient) {} } // ---- +// Warning 6335: (50-66): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (50-66): Data location must be "memory" or "calldata" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/transient_function_type_parameter.sol b/test/libsolidity/syntaxTests/dataLocations/transient_function_type_parameter.sol index 04f20e85c050..413656c6b542 100644 --- a/test/libsolidity/syntaxTests/dataLocations/transient_function_type_parameter.sol +++ b/test/libsolidity/syntaxTests/dataLocations/transient_function_type_parameter.sol @@ -3,3 +3,4 @@ contract C { } // ---- // Warning 6162: (27-41): Naming function type parameters is deprecated. +// Warning 6335: (27-41): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_exception.sol b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_exception.sol index e7541fe233d4..7ac7d5249b1f 100644 --- a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_exception.sol +++ b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_exception.sol @@ -8,5 +8,7 @@ contract C { } } // ---- +// Warning 6335: (61-88): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (90-118): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 2319: (61-88): This declaration shadows a builtin symbol. // Warning 2319: (90-118): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol index e6c7134850f6..83cd7a7bfb29 100644 --- a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol +++ b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol @@ -10,6 +10,8 @@ contract C { } } // ---- +// Warning 6335: (84-117): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (123-155): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (17-78): The name "_" is reserved. // DeclarationError 3726: (84-117): The name "super" is reserved. // DeclarationError 3726: (123-155): The name "this" is reserved. diff --git a/test/libsolidity/syntaxTests/enums/illegal_names.sol b/test/libsolidity/syntaxTests/enums/illegal_names.sol index 399d91ed1252..a088b05fabc5 100644 --- a/test/libsolidity/syntaxTests/enums/illegal_names.sol +++ b/test/libsolidity/syntaxTests/enums/illegal_names.sol @@ -21,6 +21,10 @@ contract C { E e; } // ---- +// Warning 6335: (0-19): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (20-40): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (72-76): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (82-87): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-19): The name "this" is reserved. // DeclarationError 3726: (20-40): The name "super" is reserved. // DeclarationError 3726: (41-57): The name "_" is reserved. diff --git a/test/libsolidity/syntaxTests/events/illegal_names_exception.sol b/test/libsolidity/syntaxTests/events/illegal_names_exception.sol index c45db8d7d123..99d91cc0109c 100644 --- a/test/libsolidity/syntaxTests/events/illegal_names_exception.sol +++ b/test/libsolidity/syntaxTests/events/illegal_names_exception.sol @@ -5,5 +5,7 @@ contract C { event _(); } // ---- +// Warning 6335: (80-93): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (95-109): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 2319: (80-93): This declaration shadows a builtin symbol. // Warning 2319: (95-109): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/events/illegal_names_exception_file_level.sol b/test/libsolidity/syntaxTests/events/illegal_names_exception_file_level.sol index 48b23dc38fb6..f59abd0ce275 100644 --- a/test/libsolidity/syntaxTests/events/illegal_names_exception_file_level.sol +++ b/test/libsolidity/syntaxTests/events/illegal_names_exception_file_level.sol @@ -2,3 +2,6 @@ event this(); event super(); event _(); +// ---- +// Warning 6335: (66-79): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (80-94): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol b/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol index aed22b225b61..ddca8dffe4ad 100644 --- a/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol +++ b/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol @@ -10,6 +10,8 @@ contract C { } } // ---- +// Warning 6335: (0-18): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (19-38): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-18): The name "this" is reserved. // DeclarationError 3726: (19-38): The name "super" is reserved. // DeclarationError 3726: (39-54): The name "_" is reserved. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol index b38e37177ea1..83115dcf0317 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol @@ -4,5 +4,7 @@ contract C { } // ---- // Warning 6162: (27-41): Naming function type parameters is deprecated. +// Warning 6335: (27-41): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 6162: (69-85): Naming function type parameters is deprecated. +// Warning 6335: (69-85): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (69-85): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/immutable/illegal_names.sol b/test/libsolidity/syntaxTests/immutable/illegal_names.sol index a80083ed8ba5..156c9d059d16 100644 --- a/test/libsolidity/syntaxTests/immutable/illegal_names.sol +++ b/test/libsolidity/syntaxTests/immutable/illegal_names.sol @@ -4,6 +4,8 @@ contract C { uint immutable this; } // ---- +// Warning 6335: (17-37): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (65-84): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (17-37): The name "super" is reserved. // DeclarationError 3726: (43-59): The name "_" is reserved. // DeclarationError 3726: (65-84): The name "this" is reserved. diff --git a/test/libsolidity/syntaxTests/immutable/immutable_state_var_named_transient.sol b/test/libsolidity/syntaxTests/immutable/immutable_state_var_named_transient.sol index c0ac3a8abb3c..ee043369968a 100644 --- a/test/libsolidity/syntaxTests/immutable/immutable_state_var_named_transient.sol +++ b/test/libsolidity/syntaxTests/immutable/immutable_state_var_named_transient.sol @@ -2,3 +2,4 @@ contract C { address public immutable transient; } // ---- +// Warning 6335: (17-51): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/modifiers/transient_parameter.sol b/test/libsolidity/syntaxTests/modifiers/transient_parameter.sol index be90ca54dc39..6e7ee613b42d 100644 --- a/test/libsolidity/syntaxTests/modifiers/transient_parameter.sol +++ b/test/libsolidity/syntaxTests/modifiers/transient_parameter.sol @@ -2,4 +2,5 @@ contract A { modifier mod2(uint[] transient) { _; } } // ---- +// Warning 6335: (31-47): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (31-47): Data location must be "storage", "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_function_parameters.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_function_parameters.sol index 6b5c7c99bbe7..90a83361596e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_function_parameters.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_function_parameters.sol @@ -16,6 +16,10 @@ contract C { } } // ---- +// Warning 6335: (28-38): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (70-79): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (167-177): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (238-247): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (28-38): The name "super" is reserved. // DeclarationError 3726: (70-79): The name "this" is reserved. // DeclarationError 3726: (111-117): The name "_" is reserved. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_library_using_for.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_library_using_for.sol index ac928fa9f493..8c79c7fb352b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_library_using_for.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/illegal_names_library_using_for.sol @@ -19,6 +19,8 @@ contract C { using _ for int; } // ---- +// Warning 6335: (0-49): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (51-99): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-49): The name "super" is reserved. // DeclarationError 3726: (51-99): The name "this" is reserved. // DeclarationError 3726: (100-145): The name "_" is reserved. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol index 47970c046111..35fb8329a3dd 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/shadowsBuiltin/this_super.sol @@ -5,6 +5,8 @@ contract C { } } // ---- +// Warning 6335: (52-62): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (76-85): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (52-62): The name "super" is reserved. // DeclarationError 3726: (76-85): The name "this" is reserved. // Warning 2319: (52-62): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/parsing/contract_named_transient.sol b/test/libsolidity/syntaxTests/parsing/contract_named_transient.sol index 853396f21bb5..6f78cdf41567 100644 --- a/test/libsolidity/syntaxTests/parsing/contract_named_transient.sol +++ b/test/libsolidity/syntaxTests/parsing/contract_named_transient.sol @@ -1 +1,3 @@ contract transient {} +// ---- +// Warning 6335: (0-21): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_at.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_at.sol index c5127249ab68..57ab08f17f09 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_at.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_at.sol @@ -1,2 +1,3 @@ contract at layout at 0x1234ABC { } // ---- +// Warning 6335: (0-35): "at" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_layout.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_layout.sol index 111a4fc365f8..cf7ac0e8e408 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_layout.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_named_layout.sol @@ -1,2 +1,3 @@ contract layout layout at 0x1234ABC { } // ---- +// Warning 6335: (0-39): "layout" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_with_members_named_layout_and_at.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_with_members_named_layout_and_at.sol index 7e448bba7fd5..5c27514b886d 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_with_members_named_layout_and_at.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/contract_with_members_named_layout_and_at.sol @@ -3,3 +3,5 @@ contract C layout at 0x1234 { function at() public pure { } } // ---- +// Warning 6335: (34-45): "layout" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (51-80): "at" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string_cast.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string_cast.sol index b807f2829819..229ffdb118be 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string_cast.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/hex_string_cast.sol @@ -1,3 +1,3 @@ -contract at layout at uint40(bytes5(hex"0011223344")) { } +contract C layout at uint40(bytes5(hex"0011223344")) { } // ---- -// TypeError 1505: (22-53): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. +// TypeError 1505: (21-52): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/literal_cast.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/literal_cast.sol index 067e23cf4bc7..da64e83578fe 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/literal_cast.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/literal_cast.sol @@ -1,3 +1,3 @@ -contract at layout at uint(42) { } +contract C layout at uint(42) { } // ---- -// TypeError 1505: (22-30): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. +// TypeError 1505: (21-29): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. diff --git a/test/libsolidity/syntaxTests/storageLayoutSpecifier/type_uint_max.sol b/test/libsolidity/syntaxTests/storageLayoutSpecifier/type_uint_max.sol index 6f53097c5042..1b45893120f5 100644 --- a/test/libsolidity/syntaxTests/storageLayoutSpecifier/type_uint_max.sol +++ b/test/libsolidity/syntaxTests/storageLayoutSpecifier/type_uint_max.sol @@ -1,3 +1,3 @@ -contract at layout at type(uint).max { } +contract C layout at type(uint).max { } // ---- -// TypeError 1505: (22-36): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. +// TypeError 1505: (21-35): The base slot expression contains elements that are not yet supported by the internal constant evaluator and therefore cannot be evaluated at compilation time. diff --git a/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol b/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol index 0376c3e13e31..5675570b2d73 100644 --- a/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol +++ b/test/libsolidity/syntaxTests/unusedVariables/try_catch.sol @@ -12,6 +12,7 @@ contract test { // ==== // EVMVersion: >=byzantium // ---- +// Warning 6335: (165-183): "error" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 5667: (49-55): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning 5667: (89-95): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. // Warning 5667: (122-143): Unused try/catch parameter. Remove or comment out the variable name to silence this warning. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/illegal_names.sol b/test/libsolidity/syntaxTests/variableDeclaration/illegal_names.sol index 24d1d98d6e67..4efe34798b71 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/illegal_names.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/illegal_names.sol @@ -12,6 +12,12 @@ contract D { struct _ { uint super; } } // ---- +// Warning 6335: (0-22): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (24-47): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (84-96): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (99-108): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (160-174): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (188-198): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-22): The name "this" is reserved. // DeclarationError 3726: (24-47): The name "super" is reserved. // DeclarationError 3726: (49-68): The name "_" is reserved. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/transient_as_identifier.sol b/test/libsolidity/syntaxTests/variableDeclaration/transient_as_identifier.sol index ced189faf061..3b7ee58a180d 100644 --- a/test/libsolidity/syntaxTests/variableDeclaration/transient_as_identifier.sol +++ b/test/libsolidity/syntaxTests/variableDeclaration/transient_as_identifier.sol @@ -23,3 +23,11 @@ contract D { } } // ---- +// Warning 6335: (17-53): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (75-89): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (101-115): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (127-149): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (168-181): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (253-267): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (321-334): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (368-385): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. From fbc0aa39997e6b2052088a735d2a362327c13c09 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Wed, 24 Sep 2025 16:35:49 -0300 Subject: [PATCH 03/11] Update tested docs examples --- docs/assembly.rst | 1 + docs/units-and-global-variables.rst | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/assembly.rst b/docs/assembly.rst index 0458e3196f3e..30f451c4bd94 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -46,6 +46,7 @@ Solidity language without a compiler change. pragma solidity >=0.4.16 <0.9.0; library GetCode { + // This will report a warning - `at` will be promoted to reserved keyword function at(address addr) public view returns (bytes memory code) { assembly { // retrieve the size of the code, this needs assembly diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 4d8fed283f87..59623a1df7ea 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -430,3 +430,12 @@ These keywords are reserved in Solidity. They might become part of the syntax in ``mutable``, ``null``, ``of``, ``partial``, ``promise``, ``reference``, ``relocatable``, ``sealed``, ``sizeof``, ``static``, ``supports``, ``switch``, ``typedef``, ``typeof``, ``var``. + +.. note:: + The following identifiers will become unavailable in the future due to already being part of + the language syntax and thus selected to become Solidity keywords: + ``transient``, ``layout``, ``at``, ``error``, ``super``, ``this``. + + There are also Yul identifiers which are selected to become keywords in the future: + ``leave``, ``basefee``, ``prevrandao``, ``blobbasefee``, ``blobhash``, ``mcopy``, ``tstore``, ``tload``. + From c4569c0b0fec3bcdb54a49faa22b6544e309366e Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Fri, 3 Oct 2025 15:16:43 -0300 Subject: [PATCH 04/11] Warning for yul future reserved keywords --- libyul/AsmAnalysis.cpp | 23 +++++++++++++++++++++-- libyul/AsmAnalysis.h | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 79d8bfd26860..27ff3d4285b6 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -296,9 +297,7 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) m_currentScope->insideFunction() ); for (auto const& variable: _varDecl.variables) - { expectValidIdentifier(variable.name, nativeLocationOf(variable)); - } if (_varDecl.value) { @@ -745,6 +744,8 @@ void AsmAnalyzer::expectValidIdentifier(YulName _identifier, SourceLocation cons _location, fmt::format("The identifier \"{}\" is reserved and can not be used.", label) ); + + checkFutureReservedKeywordOrIdentifier(_identifier, _location); } bool AsmAnalyzer::validateInstructions(std::string_view _instructionIdentifier, langutil::SourceLocation const& _location) @@ -953,3 +954,21 @@ void AsmAnalyzer::validateObjectStructure(langutil::SourceLocation const& _astRo } } } + +void AsmAnalyzer::checkFutureReservedKeywordOrIdentifier(YulName _identifier, langutil::SourceLocation const& _location) +{ + if ( + TokenTraits::isFutureYulKeyword(_identifier.str()) || + TokenTraits::isFutureYulReservedIdentifier(_identifier.str()) + ) + m_errorReporter.warning( + 5470_error, + _location, + fmt::format( + "\"{}\" will be promoted to reserved Yul {} in the next breaking version " + "and will not be allowed anymore as an identifier.", + _identifier.str(), + (TokenTraits::isFutureYulKeyword(_identifier.str()) ? "keyword" : "identifier") + ) + ); +} diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index 51b8cde2ba1f..38e9f81e0a9a 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -128,6 +128,8 @@ class AsmAnalyzer void validateObjectStructure(langutil::SourceLocation const& _astRootLocation); + void checkFutureReservedKeywordOrIdentifier(YulName _identifier, langutil::SourceLocation const& _location); + yul::ExternalIdentifierAccess::Resolver m_resolver; Scope* m_currentScope = nullptr; /// Variables that are active at the current point in assembly (as opposed to From 397a10758a8be6014f08262525b807f102a0ba6d Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Fri, 3 Oct 2025 15:17:12 -0300 Subject: [PATCH 05/11] Update tests (yul keywords) --- .../inlineAssembly/blobhash_pre_cancun_not_reserved.sol | 2 ++ .../inlineAssembly/prevrandao_allowed_function_pre_paris.sol | 2 ++ .../yulSyntaxTests/blobbasefee_identifier_pre_cancun.yul | 1 + test/libyul/yulSyntaxTests/blobhash_pre_cancun.yul | 2 ++ test/libyul/yulSyntaxTests/mcopy_as_identifier_pre_cancun.yul | 3 +++ test/libyul/yulSyntaxTests/mcopy_pre_cancun.yul | 3 +++ .../yulSyntaxTests/tstore_tload_as_identifiers_pre_cancun.yul | 3 +++ 7 files changed, 16 insertions(+) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol b/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol index 1ac24cc6497a..eee9f5cba4ef 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol @@ -17,3 +17,5 @@ contract C { // ==== // EVMVersion: <=shanghai // ---- +// Warning 5470: (98-106): "blobhash" will be promoted to reserved keyword in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (237-303): "blobhash" will be promoted to reserved keyword in the next breaking version and will not be allowed anymore as an identifier. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol b/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol index d85e77a45ef0..c9531412a587 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol @@ -18,3 +18,5 @@ contract C { // ==== // EVMVersion: Date: Thu, 11 Dec 2025 16:51:22 -0300 Subject: [PATCH 06/11] Changelog --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index 42d679caa3df..f84b6daf289f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,8 @@ ### 0.8.32 (unreleased) Language Features: +* Syntax Checker: Warn about identifiers selected for future promotion to Solidity keywords. +* Yul Analyzer: Warn about identifiers selected for future promotion to Yul keywords. Compiler Features: From 6be08bde2e960a4492c000bca1ea2b61fbbf37c1 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Sun, 14 Dec 2025 22:12:29 -0300 Subject: [PATCH 07/11] Add tests --- .../enums/enum_name_future_keyword_warning.sol | 6 ++++++ .../import_alias_name_future_keyword_warning.sol | 8 ++++++++ .../imports/import_name_future_keyword_warning.sol | 11 +++++++++++ .../function_name_future_keyword_warning.sol | 9 +++++++++ .../variable_name_future_keyword_warning.sol | 6 ++++++ .../structs/struct_name_future_keyword_warning.sol | 6 ++++++ .../udvt_name_future_keyword_warning.sol | 3 +++ .../variableDeclaration/variable_named_leave.sol | 4 ++++ 8 files changed, 53 insertions(+) create mode 100644 test/libsolidity/syntaxTests/enums/enum_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/imports/import_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/function_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/inlineAssembly/variable_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/structs/struct_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/userDefinedValueType/udvt_name_future_keyword_warning.sol create mode 100644 test/libsolidity/syntaxTests/variableDeclaration/variable_named_leave.sol diff --git a/test/libsolidity/syntaxTests/enums/enum_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/enums/enum_name_future_keyword_warning.sol new file mode 100644 index 000000000000..4765acc8637f --- /dev/null +++ b/test/libsolidity/syntaxTests/enums/enum_name_future_keyword_warning.sol @@ -0,0 +1,6 @@ +enum error { layout, at } +/// ---- +// ---- +// Warning 6335: (0-25): "error" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (13-19): "layout" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (21-23): "at" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol new file mode 100644 index 000000000000..b30ad95c22ae --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol @@ -0,0 +1,8 @@ +==== Source: a ==== +contract A {} +==== Source: b ==== +import {A as super} from "a"; +contract C is super {} +// ---- +// DeclarationError 3726: (b:13-18): The name "super" is reserved. +// Warning 2319: (b:13-18): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/imports/import_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/imports/import_name_future_keyword_warning.sol new file mode 100644 index 000000000000..3200d4a7aeff --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/import_name_future_keyword_warning.sol @@ -0,0 +1,11 @@ +==== Source: a ==== +uint constant CONST = 10; +==== Source: b ==== +import "a" as super; +contract C { + uint x = super.CONST; +} +// ---- +// DeclarationError 3726: (b:0-20): The name "super" is reserved. +// Warning 6335: (b:0-20): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 2319: (b:0-20): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/function_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/inlineAssembly/function_name_future_keyword_warning.sol new file mode 100644 index 000000000000..b5cebc387741 --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/function_name_future_keyword_warning.sol @@ -0,0 +1,9 @@ +contract C { + function f() pure public { + assembly { + function error (a, b , c ) -> y,x,z { + } + } + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/inlineAssembly/variable_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/inlineAssembly/variable_name_future_keyword_warning.sol new file mode 100644 index 000000000000..e954b35088eb --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/variable_name_future_keyword_warning.sol @@ -0,0 +1,6 @@ +function f() pure { + assembly { + let layout := 1 + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/structs/struct_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/structs/struct_name_future_keyword_warning.sol new file mode 100644 index 000000000000..05da7f3f799c --- /dev/null +++ b/test/libsolidity/syntaxTests/structs/struct_name_future_keyword_warning.sol @@ -0,0 +1,6 @@ +struct error { + uint layout; +} +// ---- +// Warning 6335: (0-33): "error" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. +// Warning 6335: (19-30): "layout" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/userDefinedValueType/udvt_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/userDefinedValueType/udvt_name_future_keyword_warning.sol new file mode 100644 index 000000000000..491931ed0f55 --- /dev/null +++ b/test/libsolidity/syntaxTests/userDefinedValueType/udvt_name_future_keyword_warning.sol @@ -0,0 +1,3 @@ +type error is int; +// ---- +// Warning 6335: (0-18): "error" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/variableDeclaration/variable_named_leave.sol b/test/libsolidity/syntaxTests/variableDeclaration/variable_named_leave.sol new file mode 100644 index 000000000000..40197617d188 --- /dev/null +++ b/test/libsolidity/syntaxTests/variableDeclaration/variable_named_leave.sol @@ -0,0 +1,4 @@ +contract C { + uint leave = 1; +} +// ---- From 7c4464b6d643af865cbe216ac81963fd4635f0ce Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Tue, 16 Dec 2025 19:54:19 -0300 Subject: [PATCH 08/11] fixup! Add and update tests --- .../err | 23 +++++++++++++++++++ .../illegal_names_functions.sol | 4 ++-- .../syntaxTests/enums/illegal_names.sol | 8 +++---- .../syntaxTests/errors/struct_named_error.sol | 1 + .../freeFunctions/illegal_names.sol | 4 ++-- .../function_type_with_transient_param.sol | 2 +- .../syntaxTests/immutable/illegal_names.sol | 4 ++-- ...port_alias_name_future_keyword_warning.sol | 7 +++--- .../blobhash_pre_cancun_not_reserved.sol | 4 ++-- ...ash_with_non_reserved_pure_yul_builtin.sol | 5 ++++ .../prevrandao_allowed_function_pre_paris.sol | 4 ++-- .../syntaxTests/modifiers/illegal_name.sol | 2 ++ .../illegal_names_function_parameters.sol | 8 +++---- .../illegal_names_library_using_for.sol | 4 ++-- .../illegal_names_using_for.sol | 2 ++ .../shadowsBuiltin/this_super.sol | 4 ++-- .../syntaxTests/structs/illegal_names.sol | 2 ++ .../variableDeclaration/illegal_names.sol | 12 +++++----- .../variable_named_leave.sol | 1 + .../blobbasefee_identifier_pre_cancun.yul | 2 +- .../yulSyntaxTests/blobhash_pre_cancun.yul | 4 ++-- .../mcopy_as_identifier_pre_cancun.yul | 4 ++-- .../yulSyntaxTests/mcopy_pre_cancun.yul | 4 ++-- ...tstore_tload_as_identifiers_pre_cancun.yul | 4 ++-- 24 files changed, 77 insertions(+), 42 deletions(-) create mode 100644 test/cmdlineTests/memoryguard_shadowing_by_inline_assembly_identifiers/err diff --git a/test/cmdlineTests/memoryguard_shadowing_by_inline_assembly_identifiers/err b/test/cmdlineTests/memoryguard_shadowing_by_inline_assembly_identifiers/err new file mode 100644 index 000000000000..2c3d00161171 --- /dev/null +++ b/test/cmdlineTests/memoryguard_shadowing_by_inline_assembly_identifiers/err @@ -0,0 +1,23 @@ +Warning: "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. + --> input.sol:10:20: + | +10 | assembly { function memoryguard() {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +Warning: "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. + --> input.sol:11:31: + | +11 | assembly { function f(memoryguard) {} } + | ^^^^^^^^^^^ + +Warning: "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. + --> input.sol:12:36: + | +12 | assembly { function f() -> memoryguard {} } + | ^^^^^^^^^^^ + +Warning: "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. + --> input.sol:13:24: + | +13 | assembly { let memoryguard } + | ^^^^^^^^^^^ diff --git a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol index 83cd7a7bfb29..7c0b1f81b020 100644 --- a/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol +++ b/test/libsolidity/syntaxTests/duplicateFunctions/illegal_names_functions.sol @@ -10,10 +10,10 @@ contract C { } } // ---- -// Warning 6335: (84-117): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (123-155): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (17-78): The name "_" is reserved. // DeclarationError 3726: (84-117): The name "super" is reserved. +// Warning 6335: (84-117): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (123-155): The name "this" is reserved. +// Warning 6335: (123-155): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 2319: (84-117): This declaration shadows a builtin symbol. // Warning 2319: (123-155): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/enums/illegal_names.sol b/test/libsolidity/syntaxTests/enums/illegal_names.sol index a088b05fabc5..ab747607fb1b 100644 --- a/test/libsolidity/syntaxTests/enums/illegal_names.sol +++ b/test/libsolidity/syntaxTests/enums/illegal_names.sol @@ -21,15 +21,15 @@ contract C { E e; } // ---- -// Warning 6335: (0-19): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (20-40): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (72-76): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (82-87): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-19): The name "this" is reserved. +// Warning 6335: (0-19): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (20-40): The name "super" is reserved. +// Warning 6335: (20-40): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (41-57): The name "_" is reserved. // DeclarationError 3726: (72-76): The name "this" is reserved. +// Warning 6335: (72-76): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (82-87): The name "super" is reserved. +// Warning 6335: (82-87): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (93-94): The name "_" is reserved. // Warning 2319: (0-19): This declaration shadows a builtin symbol. // Warning 2319: (20-40): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/errors/struct_named_error.sol b/test/libsolidity/syntaxTests/errors/struct_named_error.sol index 0ee82ead66ae..9ef8e04f1f47 100644 --- a/test/libsolidity/syntaxTests/errors/struct_named_error.sol +++ b/test/libsolidity/syntaxTests/errors/struct_named_error.sol @@ -4,3 +4,4 @@ contract C { error x; } // ---- +// Warning 6335: (52-74): "error" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol b/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol index ddca8dffe4ad..d57d36584f7f 100644 --- a/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol +++ b/test/libsolidity/syntaxTests/freeFunctions/illegal_names.sol @@ -10,10 +10,10 @@ contract C { } } // ---- -// Warning 6335: (0-18): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (19-38): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (0-18): The name "this" is reserved. +// Warning 6335: (0-18): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (19-38): The name "super" is reserved. +// Warning 6335: (19-38): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (39-54): The name "_" is reserved. // Warning 2319: (0-18): This declaration shadows a builtin symbol. // Warning 2319: (19-38): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol b/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol index 83115dcf0317..ef3ec76aa0e7 100644 --- a/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol +++ b/test/libsolidity/syntaxTests/functionTypes/function_type_with_transient_param.sol @@ -4,7 +4,7 @@ contract C { } // ---- // Warning 6162: (27-41): Naming function type parameters is deprecated. -// Warning 6335: (27-41): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 6162: (69-85): Naming function type parameters is deprecated. +// Warning 6335: (27-41): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 6335: (69-85): "transient" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // TypeError 6651: (69-85): Data location must be "memory" or "calldata" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/immutable/illegal_names.sol b/test/libsolidity/syntaxTests/immutable/illegal_names.sol index 156c9d059d16..a9c03fc8966d 100644 --- a/test/libsolidity/syntaxTests/immutable/illegal_names.sol +++ b/test/libsolidity/syntaxTests/immutable/illegal_names.sol @@ -4,10 +4,10 @@ contract C { uint immutable this; } // ---- -// Warning 6335: (17-37): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. -// Warning 6335: (65-84): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (17-37): The name "super" is reserved. +// Warning 6335: (17-37): "super" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // DeclarationError 3726: (43-59): The name "_" is reserved. // DeclarationError 3726: (65-84): The name "this" is reserved. +// Warning 6335: (65-84): "this" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. // Warning 2319: (17-37): This declaration shadows a builtin symbol. // Warning 2319: (65-84): This declaration shadows a builtin symbol. diff --git a/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol b/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol index b30ad95c22ae..81b58b0f7ece 100644 --- a/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol +++ b/test/libsolidity/syntaxTests/imports/import_alias_name_future_keyword_warning.sol @@ -1,8 +1,7 @@ ==== Source: a ==== contract A {} ==== Source: b ==== -import {A as super} from "a"; -contract C is super {} +import {A as layout} from "a"; +contract C is layout {} // ---- -// DeclarationError 3726: (b:13-18): The name "super" is reserved. -// Warning 2319: (b:13-18): This declaration shadows a builtin symbol. +// Warning 6335: (a:0-13): "layout" will be promoted to keyword in the next breaking version and will not be allowed as an identifier anymore. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol b/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol index eee9f5cba4ef..1255c2678299 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/blobhash_pre_cancun_not_reserved.sol @@ -17,5 +17,5 @@ contract C { // ==== // EVMVersion: <=shanghai // ---- -// Warning 5470: (98-106): "blobhash" will be promoted to reserved keyword in the next breaking version and will not be allowed anymore as an identifier. -// Warning 5470: (237-303): "blobhash" will be promoted to reserved keyword in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (98-106): "blobhash" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (237-303): "blobhash" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/clash_with_non_reserved_pure_yul_builtin.sol b/test/libsolidity/syntaxTests/inlineAssembly/clash_with_non_reserved_pure_yul_builtin.sol index 9b6ee266c3ed..374861cd4191 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/clash_with_non_reserved_pure_yul_builtin.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/clash_with_non_reserved_pure_yul_builtin.sol @@ -8,3 +8,8 @@ contract C { assembly { let memoryguard } } } +// ---- +// Warning 5470: (207-232): "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (265-276): "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (318-329): "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. +// Warning 5470: (358-369): "memoryguard" will be promoted to reserved Yul identifier in the next breaking version and will not be allowed anymore as an identifier. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol b/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol index c9531412a587..afa91be97aef 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/prevrandao_allowed_function_pre_paris.sol @@ -18,5 +18,5 @@ contract C { // ==== // EVMVersion: Date: Wed, 17 Dec 2025 02:25:56 -0300 Subject: [PATCH 09/11] workaround for openzeppelin external tests --- test/externalTests/zeppelin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index aca8311ac94c..c26038e0b971 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -116,7 +116,7 @@ function zeppelin_test const result = await runSuper(args); result.output.errors = (result.output.errors || []).filter(err => { - if (err.severity === "warning" && err.message.includes("deprecated")) { + if (err.severity === "warning" && (err.message.includes("deprecated") || err.message.includes("promoted"))) { return false; // suppress this warning } return true; From d1199718fb55888652606495b4a097dea6fbb60e Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Wed, 17 Dec 2025 12:05:01 -0300 Subject: [PATCH 10/11] fixup! Warning for yul future reserved keywords --- liblangutil/Token.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/liblangutil/Token.cpp b/liblangutil/Token.cpp index 451412b0d5c2..a99272bef4b6 100644 --- a/liblangutil/Token.cpp +++ b/liblangutil/Token.cpp @@ -176,6 +176,7 @@ bool isFutureYulReservedIdentifier(std::string const& _literal) "basefee", "blobbasefee", "blobhash", + "clz", "mcopy", "memoryguard", "prevrandao", From 11c84a33743eff1e1c099c0a51c1ce8e031cb899 Mon Sep 17 00:00:00 2001 From: Matheus Aguiar Date: Wed, 17 Dec 2025 12:37:16 -0300 Subject: [PATCH 11/11] fixup! Update tests (yul keywords) --- test/libyul/yulSyntaxTests/clz_pre_osaka.yul | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/libyul/yulSyntaxTests/clz_pre_osaka.yul b/test/libyul/yulSyntaxTests/clz_pre_osaka.yul index 7380965981bb..85891797f310 100644 --- a/test/libyul/yulSyntaxTests/clz_pre_osaka.yul +++ b/test/libyul/yulSyntaxTests/clz_pre_osaka.yul @@ -12,3 +12,5 @@ // ==== // EVMVersion: