diff options
72 files changed, 191 insertions, 386 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst index 108d4c96..f6cfdc2c 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -79,6 +79,7 @@ Solidity always places new objects at the free memory pointer and memory is neve .. warning:: There are some operations in Solidity that need a temporary memory area larger than 64 bytes and therefore will not fit into the scratch space. They will be placed where the free memory points to, but given their short lifecycle, the pointer is not updated. The memory may or may not be zeroed out. Because of this, one shouldn't expect the free memory to be zeroed out. + While it may seem like a good idea to use ``msize`` to arrive at a definitely zeroed out memory area, using such a pointer non-temporarily without updating the free memory pointer can have adverse results. .. index: calldata layout diff --git a/libjulia/Exceptions.h b/libjulia/Exceptions.h index 20ab6520..48624a56 100644 --- a/libjulia/Exceptions.h +++ b/libjulia/Exceptions.h @@ -15,7 +15,7 @@ along with solidity. If not, see <http://www.gnu.org/licenses/>. */ /** - * Exceptions in Julia. + * Exceptions in Yul. */ #pragma once @@ -28,8 +28,8 @@ namespace dev namespace julia { -struct IuliaException: virtual Exception {}; -struct OptimizerException: virtual IuliaException {}; +struct YulException: virtual Exception {}; +struct OptimizerException: virtual YulException {}; } } diff --git a/libjulia/backends/evm/AbstractAssembly.h b/libjulia/backends/evm/AbstractAssembly.h index 8e90a912..46fa7796 100644 --- a/libjulia/backends/evm/AbstractAssembly.h +++ b/libjulia/backends/evm/AbstractAssembly.h @@ -42,7 +42,7 @@ namespace julia { /// -/// Assembly class that abstracts both the libevmasm assembly and the new julia evm assembly. +/// Assembly class that abstracts both the libevmasm assembly and the new Yul assembly. /// class AbstractAssembly { diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp index 2a97429b..ba2d7f75 100644 --- a/libjulia/backends/evm/EVMCodeTransform.cpp +++ b/libjulia/backends/evm/EVMCodeTransform.cpp @@ -15,7 +15,7 @@ along with solidity. If not, see <http://www.gnu.org/licenses/>. */ /** - * Common code generator for translating Julia / inline assembly to EVM and EVM1.5. + * Common code generator for translating Yul / inline assembly to EVM and EVM1.5. */ #include <libjulia/backends/evm/EVMCodeTransform.h> @@ -331,7 +331,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function) CodeTransform( m_assembly, m_info, - m_julia, + m_yul, m_evm15, m_identifierAccess, m_useNamedLabelsForFunctions, diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h index f8eec0b7..ed0785d3 100644 --- a/libjulia/backends/evm/EVMCodeTransform.h +++ b/libjulia/backends/evm/EVMCodeTransform.h @@ -15,7 +15,7 @@ along with solidity. If not, see <http://www.gnu.org/licenses/>. */ /** - * Common code generator for translating Julia / inline assembly to EVM and EVM1.5. + * Common code generator for translating Yul / inline assembly to EVM and EVM1.5. */ #include <libjulia/backends/evm/EVMAssembly.h> @@ -49,14 +49,14 @@ public: CodeTransform( julia::AbstractAssembly& _assembly, solidity::assembly::AsmAnalysisInfo& _analysisInfo, - bool _julia = false, + bool _yul = false, bool _evm15 = false, ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess(), bool _useNamedLabelsForFunctions = false ): CodeTransform( _assembly, _analysisInfo, - _julia, + _yul, _evm15, _identifierAccess, _useNamedLabelsForFunctions, @@ -78,7 +78,7 @@ protected: CodeTransform( julia::AbstractAssembly& _assembly, solidity::assembly::AsmAnalysisInfo& _analysisInfo, - bool _julia, + bool _yul, bool _evm15, ExternalIdentifierAccess const& _identifierAccess, bool _useNamedLabelsForFunctions, @@ -87,7 +87,7 @@ protected: ): m_assembly(_assembly), m_info(_analysisInfo), - m_julia(_julia), + m_yul(_yul), m_evm15(_evm15), m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions), m_identifierAccess(_identifierAccess), @@ -142,7 +142,7 @@ private: julia::AbstractAssembly& m_assembly; solidity::assembly::AsmAnalysisInfo& m_info; solidity::assembly::Scope* m_scope = nullptr; - bool m_julia = false; + bool m_yul = false; bool m_evm15 = false; bool m_useNamedLabelsForFunctions = false; ExternalIdentifierAccess m_identifierAccess; diff --git a/libjulia/optimiser/ASTCopier.h b/libjulia/optimiser/ASTCopier.h index 8681f2e0..cb2925e3 100644 --- a/libjulia/optimiser/ASTCopier.h +++ b/libjulia/optimiser/ASTCopier.h @@ -62,7 +62,7 @@ public: }; /** - * Creates a copy of a iulia AST potentially replacing identifier names. + * Creates a copy of a Yul AST potentially replacing identifier names. * Base class to be extended. */ class ASTCopier: public ExpressionCopier, public StatementCopier diff --git a/libjulia/optimiser/Disambiguator.h b/libjulia/optimiser/Disambiguator.h index 6fc8a615..4ef43736 100644 --- a/libjulia/optimiser/Disambiguator.h +++ b/libjulia/optimiser/Disambiguator.h @@ -38,7 +38,7 @@ namespace julia { /** - * Creates a copy of a iulia AST replacing all identifiers by unique names. + * Creates a copy of a Yul AST replacing all identifiers by unique names. */ class Disambiguator: public ASTCopier { diff --git a/libjulia/optimiser/README.md b/libjulia/optimiser/README.md index 1b000294..b1ce8931 100644 --- a/libjulia/optimiser/README.md +++ b/libjulia/optimiser/README.md @@ -1,6 +1,6 @@ -## IULIA Optimiser +## Yul Optimiser -The iulia optimiser consists of several stages and components that all transform +The Yul optimiser consists of several stages and components that all transform the AST in a semantically equivalent way. The goal is to end up either with code that is shorter or at least only marginally longer but will allow further optimisation steps. @@ -81,7 +81,7 @@ a loop or conditional, the first one is not inside), the first assignment is rem ## Expression Simplifier -This step can only be applied for the EVM-flavoured dialect of iulia. It applies +This step can only be applied for the EVM-flavoured dialect of Yul. It applies simple rules like ``x + 0 == x`` to simplify expressions. ## Ineffective Statement Remover diff --git a/libjulia/optimiser/UnusedPruner.cpp b/libjulia/optimiser/UnusedPruner.cpp index 54e8fd6e..af503712 100644 --- a/libjulia/optimiser/UnusedPruner.cpp +++ b/libjulia/optimiser/UnusedPruner.cpp @@ -59,7 +59,7 @@ void UnusedPruner::operator()(Block& _block) // Multi-variable declarations are special. We can only remove it // if all vairables are unused and the right-hand-side is either // movable or it return a single value. In the latter case, we - // replace `let a := f()` by `pop(f())` (in pure IULIA, this will be + // replace `let a := f()` by `pop(f())` (in pure Yul, this will be // `drop(f())`). if (boost::algorithm::none_of( varDecl.variables, @@ -74,7 +74,7 @@ void UnusedPruner::operator()(Block& _block) statement = Block{std::move(varDecl.location), {}}; } else if (varDecl.variables.size() == 1) - // In pure IULIA, this should be replaced by a function call to `drop` + // In pure Yul, this should be replaced by a function call to `drop` // instead of `pop`. statement = ExpressionStatement{varDecl.location, FunctionalInstruction{ varDecl.location, diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index baaeafa0..4359c3fa 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -122,6 +122,8 @@ public: m_optimizeRuns = _runs; } + /// Set the EVM version used before running compile. + /// When called without an argument it will revert to the default version. void setEVMVersion(EVMVersion _version = EVMVersion{}); /// Sets the list of requested contract names. If empty, no filtering is performed and every contract @@ -240,9 +242,7 @@ public: Json::Value gasEstimates(std::string const& _contractName) const; private: - /** - * Information pertaining to one source unit, filled gradually during parsing and compilation. - */ + /// The state per source unit. Filled gradually during parsing. struct Source { std::shared_ptr<Scanner> scanner; @@ -251,13 +251,14 @@ private: void reset() { scanner.reset(); ast.reset(); } }; + /// The state per contract. Filled gradually during compilation. struct Contract { ContractDefinition const* contract = nullptr; std::shared_ptr<Compiler> compiler; - eth::LinkerObject object; - eth::LinkerObject runtimeObject; - eth::LinkerObject cloneObject; + eth::LinkerObject object; ///< Deployment object (includes the runtime sub-object). + eth::LinkerObject runtimeObject; ///< Runtime object. + eth::LinkerObject cloneObject; ///< Clone object (deprecated). std::string metadata; ///< The metadata json that will be hashed into the chain. mutable std::unique_ptr<Json::Value const> abi; mutable std::unique_ptr<Json::Value const> userDocumentation; @@ -272,8 +273,10 @@ private: StringMap loadMissingSources(SourceUnit const& _ast, std::string const& _path); std::string applyRemapping(std::string const& _path, std::string const& _context); void resolveImports(); + /// @returns the absolute path corresponding to @a _path relative to @a _reference. static std::string absolutePath(std::string const& _path, std::string const& _reference); + /// Helper function to return path converted strings. static std::string sanitizePath(std::string const& _path) { return boost::filesystem::path(_path).generic_string(); } @@ -285,21 +288,42 @@ private: ContractDefinition const& _contract, std::map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts ); + + /// Links all the known library addresses in the available objects. Any unknown + /// library will still be kept as an unlinked placeholder in the objects. void link(); + /// @returns the contract object for the given @a _contractName. + /// Can only be called after state is CompilationSuccessful. Contract const& contract(std::string const& _contractName) const; + + /// @returns the source object for the given @a _sourceName. + /// Can only be called after state is SourcesSet. Source const& source(std::string const& _sourceName) const; /// @returns the parsed contract with the supplied name. Throws an exception if the contract /// does not exist. ContractDefinition const& contractDefinition(std::string const& _contractName) const; + /// @returns the metadata JSON as a compact string for the given contract. std::string createMetadata(Contract const& _contract) const; + /// @returns the metadata CBOR for the given serialised metadata JSON. static bytes createCBORMetadata(std::string _metadata, bool _experimentalMode); + + /// @returns the computer source mapping string. std::string computeSourceMapping(eth::AssemblyItems const& _items) const; + + /// @returns the contract ABI as a JSON object. + /// This will generate the JSON object and store it in the Contract object if it is not present yet. Json::Value const& contractABI(Contract const&) const; + + /// @returns the Natspec User documentation as a JSON object. + /// This will generate the JSON object and store it in the Contract object if it is not present yet. Json::Value const& natspecUser(Contract const&) const; + + /// @returns the Natspec Developer documentation as a JSON object. + /// This will generate the JSON object and store it in the Contract object if it is not present yet. Json::Value const& natspecDev(Contract const&) const; /// @returns the offset of the entry point of the given function into the list of assembly items diff --git a/test/libjulia/CommonSubexpression.cpp b/test/libjulia/CommonSubexpression.cpp index 8a575c48..6c8edf1f 100644 --- a/test/libjulia/CommonSubexpression.cpp +++ b/test/libjulia/CommonSubexpression.cpp @@ -47,7 +47,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaCSE) +BOOST_AUTO_TEST_SUITE(YulCSE) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/Disambiguator.cpp b/test/libjulia/Disambiguator.cpp index ba1a06b0..48e02c7e 100644 --- a/test/libjulia/Disambiguator.cpp +++ b/test/libjulia/Disambiguator.cpp @@ -39,7 +39,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaDisambiguator) +BOOST_AUTO_TEST_SUITE(YulDisambiguator) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/FunctionGrouper.cpp b/test/libjulia/FunctionGrouper.cpp index 78f382cb..f1e83449 100644 --- a/test/libjulia/FunctionGrouper.cpp +++ b/test/libjulia/FunctionGrouper.cpp @@ -16,7 +16,7 @@ */ /** * @date 2017 - * Unit tests for the iulia function grouper. + * Unit tests for the Yul function grouper. */ #include <test/libjulia/Common.h> @@ -43,7 +43,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaFunctionGrouper) +BOOST_AUTO_TEST_SUITE(YulFunctionGrouper) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/FunctionHoister.cpp b/test/libjulia/FunctionHoister.cpp index 3d6fff85..348963b4 100644 --- a/test/libjulia/FunctionHoister.cpp +++ b/test/libjulia/FunctionHoister.cpp @@ -16,7 +16,7 @@ */ /** * @date 2017 - * Unit tests for the iulia function hoister. + * Unit tests for the Yul function hoister. */ #include <test/libjulia/Common.h> @@ -43,7 +43,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaFunctionHoister) +BOOST_AUTO_TEST_SUITE(YulFunctionHoister) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/Inliner.cpp b/test/libjulia/Inliner.cpp index 464dcd93..2f5b7cff 100644 --- a/test/libjulia/Inliner.cpp +++ b/test/libjulia/Inliner.cpp @@ -16,7 +16,7 @@ */ /** * @date 2017 - * Unit tests for the iulia function inliner. + * Unit tests for the Yul function inliner. */ #include <test/libjulia/Common.h> @@ -55,24 +55,24 @@ string inlinableFunctions(string const& _source) ); } -string inlineFunctions(string const& _source, bool _julia = true) +string inlineFunctions(string const& _source, bool _yul = true) { - auto ast = disambiguate(_source, _julia); + auto ast = disambiguate(_source, _yul); ExpressionInliner(ast).run(); - return assembly::AsmPrinter(_julia)(ast); + return assembly::AsmPrinter(_yul)(ast); } -string fullInline(string const& _source, bool _julia = true) +string fullInline(string const& _source, bool _yul = true) { - Block ast = disambiguate(_source, _julia); + Block ast = disambiguate(_source, _yul); (FunctionHoister{})(ast); (FunctionGrouper{})(ast);\ FullInliner(ast).run(); - return assembly::AsmPrinter(_julia)(ast); + return assembly::AsmPrinter(_yul)(ast); } } -BOOST_AUTO_TEST_SUITE(IuliaInlinableFunctionFilter) +BOOST_AUTO_TEST_SUITE(YulInlinableFunctionFilter) BOOST_AUTO_TEST_CASE(smoke_test) { @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(negative) BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE(IuliaFunctionInliner) +BOOST_AUTO_TEST_SUITE(YulFunctionInliner) BOOST_AUTO_TEST_CASE(simple) { @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(double_recursive_calls) BOOST_AUTO_TEST_SUITE_END() -BOOST_AUTO_TEST_SUITE(IuliaFullInliner) +BOOST_AUTO_TEST_SUITE(YulFullInliner) BOOST_AUTO_TEST_CASE(simple) { diff --git a/test/libjulia/MainFunction.cpp b/test/libjulia/MainFunction.cpp index c26b002d..e7263d13 100644 --- a/test/libjulia/MainFunction.cpp +++ b/test/libjulia/MainFunction.cpp @@ -16,7 +16,7 @@ */ /** * @date 2018 - * Unit tests for the Julia MainFunction transformation. + * Unit tests for the Yul MainFunction transformation. */ #include <test/libjulia/Common.h> @@ -45,7 +45,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(JuliaMainFunction) +BOOST_AUTO_TEST_SUITE(YulMainFunction) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp index c59f91da..07154718 100644 --- a/test/libjulia/Parser.cpp +++ b/test/libjulia/Parser.cpp @@ -119,7 +119,7 @@ do \ BOOST_CHECK(searchErrorMessage(err, (substring))); \ } while(0) -BOOST_AUTO_TEST_SUITE(JuliaParser) +BOOST_AUTO_TEST_SUITE(YulParser) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/Rematerialiser.cpp b/test/libjulia/Rematerialiser.cpp index 8f928f8e..63e525d5 100644 --- a/test/libjulia/Rematerialiser.cpp +++ b/test/libjulia/Rematerialiser.cpp @@ -48,7 +48,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaRematerialiser) +BOOST_AUTO_TEST_SUITE(YulRematerialiser) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp index 4d4e8d53..8ed8287a 100644 --- a/test/libjulia/Simplifier.cpp +++ b/test/libjulia/Simplifier.cpp @@ -48,7 +48,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaSimplifier) +BOOST_AUTO_TEST_SUITE(YulSimplifier) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libjulia/UnusedPruner.cpp b/test/libjulia/UnusedPruner.cpp index b86a54b3..649ee149 100644 --- a/test/libjulia/UnusedPruner.cpp +++ b/test/libjulia/UnusedPruner.cpp @@ -48,7 +48,7 @@ do\ }\ while(false) -BOOST_AUTO_TEST_SUITE(IuliaUnusedPruner) +BOOST_AUTO_TEST_SUITE(YulUnusedPruner) BOOST_AUTO_TEST_CASE(smoke_test) { diff --git a/test/libsolidity/syntaxTests/empty_string_var.sol b/test/libsolidity/syntaxTests/empty_string_var.sol deleted file mode 100644 index e9837590..00000000 --- a/test/libsolidity/syntaxTests/empty_string_var.sol +++ /dev/null @@ -1,11 +0,0 @@ -contract C { - function f() { - var a = ""; - bytes1 b = bytes1(a); - bytes memory c = bytes(a); - string memory d = string(a); - } -} -// ---- -// Warning: (34-39): Use of the "var" keyword is deprecated. -// TypeError: (61-70): Explicit type conversion not allowed from "string memory" to "bytes1". diff --git a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol index a6fe6c22..2481c455 100644 --- a/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol +++ b/test/libsolidity/syntaxTests/functionTypes/delete_function_type.sol @@ -3,15 +3,13 @@ contract C { function(uint) internal returns (uint) y; function f() public { delete x; - var a = y; + function(uint) internal returns (uint) a = y; delete a; delete y; - var c = f; + function() internal c = f; delete c; function(uint) internal returns (uint) g; delete g; } } // ---- -// Warning: (157-162): Use of the "var" keyword is deprecated. -// Warning: (212-217): Use of the "var" keyword is deprecated. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol deleted file mode 100644 index c8686ae8..00000000 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalid.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract C { - function f() internal returns (uint, uint, uint, uint) { - var (uint a, uint b,,) = f(); - a; b; - } -} -// ---- -// ParserError: (81-85): Expected identifier but got 'uint' diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol deleted file mode 100644 index 4c4c62a5..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/005_type_inference_smoke_test.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract test { - function f(uint256 arg1, uint32 arg2) public returns (bool ret) { - var x = arg1 + arg2 == 8; ret = x; - } -} -// ---- -// Warning: (94-99): Use of the "var" keyword is deprecated. -// Warning: (20-134): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol deleted file mode 100644 index 70d31f25..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/012_type_inference_explicit_conversion.sol +++ /dev/null @@ -1,6 +0,0 @@ -contract test { - function f() public returns (int256 r) { var x = int256(uint32(2)); return x; } -} -// ---- -// Warning: (61-66): Use of the "var" keyword is deprecated. -// Warning: (20-99): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol index 18ff6054..7f858a4d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/013_large_string_literal.sol @@ -1,7 +1,6 @@ contract test { - function f() public { var x = "123456789012345678901234567890123"; } + function f() public { string memory x = "123456789012345678901234567890123"; } } // ---- -// Warning: (42-47): Use of the "var" keyword is deprecated. -// Warning: (42-47): Unused local variable. -// Warning: (20-88): Function state mutability can be restricted to pure +// Warning: (42-57): Unused local variable. +// Warning: (20-98): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol index 764f630f..8bf45c3f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/016_assignment_to_mapping.sol @@ -4,10 +4,9 @@ contract test { } str data; function fun() public { - var a = data.map; + mapping(uint=>uint) a = data.map; data.map = a; } } // ---- -// Warning: (122-127): Use of the "var" keyword is deprecated. -// TypeError: (148-160): Mappings cannot be assigned to. +// TypeError: (164-176): Mappings cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol index f7db0b24..6fbd09ae 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/017_assignment_to_struct.sol @@ -4,9 +4,8 @@ contract test { } str data; function fun() public { - var a = data; + str storage a = data; data = a; } } // ---- -// Warning: (122-127): Use of the "var" keyword is deprecated. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol index 78d89ef8..27651d63 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/025_comparison_of_mapping_types.sol @@ -1,10 +1,9 @@ contract C { mapping(uint => uint) x; function f() public returns (bool ret) { - var y = x; + mapping(uint => uint) y = x; return x == y; } } // ---- -// Warning: (95-100): Use of the "var" keyword is deprecated. -// TypeError: (121-127): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256) +// TypeError: (139-145): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256) diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol deleted file mode 100644 index b79b976a..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/109_disallow_declaration_of_void_type.sol +++ /dev/null @@ -1,7 +0,0 @@ -contract c { - function f() public { var (x) = f(); } -} -// ---- -// Warning: (44-45): Use of the "var" keyword is deprecated. -// Warning: (39-52): Different number of components on the left hand side (1) than on the right hand side (0). -// TypeError: (39-52): Not enough components (0) in value to assign all variables (1). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol deleted file mode 100644 index db086252..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/120_warn_var_from_uint8.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract test { - function f() pure public returns (uint) { - var i = 1; - return i; - } -} -// ---- -// Warning: (70-75): Use of the "var" keyword is deprecated. -// Warning: (70-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol deleted file mode 100644 index 2b48ce5d..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/121_warn_var_from_uint256.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract test { - function f() pure public { - var i = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; - i; - } -} -// ---- -// Warning: (55-60): Use of the "var" keyword is deprecated. -// Warning: (55-129): The type of this variable was inferred as uint256, which can hold values between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935. This is probably not desired. Use an explicit type to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol deleted file mode 100644 index bebcbab5..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/122_warn_var_from_int8.sol +++ /dev/null @@ -1,9 +0,0 @@ -contract test { - function f() pure public { - var i = -2; - i; - } -} -// ---- -// Warning: (55-60): Use of the "var" keyword is deprecated. -// Warning: (55-65): The type of this variable was inferred as int8, which can hold values between -128 and 127. This is probably not desired. Use an explicit type to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol deleted file mode 100644 index 3d269993..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/123_warn_var_from_zero.sol +++ /dev/null @@ -1,8 +0,0 @@ - contract test { - function f() pure public { - for (var i = 0; i < msg.data.length; i++) { } - } - } -// ---- -// Warning: (63-68): Use of the "var" keyword is deprecated. -// Warning: (63-72): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol index f7daa33f..07fc1c43 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/178_assignment_of_nonoverloaded_function.sol @@ -1,7 +1,6 @@ contract test { function f(uint a) public returns (uint) { return 2 * a; } - function g() public returns (uint) { var x = f; return x(7); } + function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); } } // ---- -// Warning: (120-125): Use of the "var" keyword is deprecated. // Warning: (20-78): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol index 375980c3..9ed864f1 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/179_assignment_of_overloaded_function.sol @@ -1,8 +1,7 @@ contract test { function f() public returns (uint) { return 1; } function f(uint a) public returns (uint) { return 2 * a; } - function g() public returns (uint) { var x = f; return x(7); } + function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); } } // ---- -// Warning: (173-178): Use of the "var" keyword is deprecated. -// TypeError: (181-182): No matching declaration found after variable lookup. +// TypeError: (208-209): No matching declaration found after variable lookup. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol deleted file mode 100644 index 61836b59..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/183_uninitialized_var.sol +++ /dev/null @@ -1,6 +0,0 @@ -contract C { - function f() public returns (uint) { var x; return 2; } -} -// ---- -// Warning: (54-59): Use of the "var" keyword is deprecated. -// TypeError: (54-59): Assignment necessary for type detection. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol index 8e838537..9d51e06b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol @@ -1,7 +1,6 @@ contract C { string s; - function f() public { var a = s[2]; } + function f() public { bytes1 a = s[2]; } } // ---- -// Warning: (53-58): Use of the "var" keyword is deprecated. -// TypeError: (61-65): Index access for string is not possible. +// TypeError: (64-68): Index access for string is not possible. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol index 36be82c9..9e714d68 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/189_string_length.sol @@ -1,7 +1,6 @@ contract C { string s; - function f() public { var a = s.length; } + function f() public { uint a = s.length; } } // ---- -// Warning: (53-58): Use of the "var" keyword is deprecated. -// TypeError: (61-69): Member "length" not found or not visible after argument-dependent lookup in string storage ref +// TypeError: (62-70): Member "length" not found or not visible after argument-dependent lookup in string storage ref diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol index a2048a8a..febe39e6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/208_assignment_mem_to_local_storage_variable.sol @@ -1,10 +1,9 @@ contract C { uint[] data; function f(uint[] x) public { - var dataRef = data; + uint[] storage dataRef = data; dataRef = x; } } // ---- -// Warning: (72-83): Use of the "var" keyword is deprecated. -// TypeError: (110-111): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer. +// TypeError: (121-122): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol index d17b62e4..7a6fb1c7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol @@ -1,10 +1,9 @@ contract C { uint[] data; function f() public { - var x = data; + uint[] storage x = data; delete x; } } // ---- -// Warning: (64-69): Use of the "var" keyword is deprecated. -// TypeError: (86-94): Unary operator delete cannot be applied to type uint256[] storage pointer +// TypeError: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol index 8dbaef9c..8624b0b0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/230_creating_contract_within_the_contract.sol @@ -1,6 +1,5 @@ contract Test { - function f() public { var x = new Test(); } + function f() public { Test x = new Test(); } } // ---- -// Warning: (42-47): Use of the "var" keyword is deprecated. -// TypeError: (50-58): Circular reference for contract creation (cannot create instance of derived or same contract). +// TypeError: (51-59): Circular reference for contract creation (cannot create instance of derived or same contract). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol deleted file mode 100644 index de115d12..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/238_multi_variable_declaration_fail.sol +++ /dev/null @@ -1,5 +0,0 @@ -contract C { function f() public { var (x,y); x = 1; y = 1;} } -// ---- -// Warning: (40-41): Use of the "var" keyword is deprecated. -// Warning: (42-43): Use of the "var" keyword is deprecated. -// TypeError: (35-44): Assignment necessary for type detection. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol index a1cfb070..ae260ce4 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol @@ -3,24 +3,18 @@ contract C { function two() public returns (uint, uint); function none(); function f() public { - var (a,) = three(); - var (b,c,) = two(); - var (,d) = three(); - var (,e,g) = two(); + (uint a,) = three(); + (uint b, uint c,) = two(); + (,uint d) = three(); + (,uint e, uint g) = two(); var (,,) = three(); var () = none(); a;b;c;d;e;g; } } // ---- -// Warning: (177-178): Use of the "var" keyword is deprecated. -// Warning: (205-206): Use of the "var" keyword is deprecated. -// Warning: (207-208): Use of the "var" keyword is deprecated. -// Warning: (234-235): Use of the "var" keyword is deprecated. -// Warning: (262-263): Use of the "var" keyword is deprecated. -// Warning: (264-265): Use of the "var" keyword is deprecated. -// Warning: (172-190): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (200-218): Different number of components on the left hand side (3) than on the right hand side (2). -// Warning: (228-246): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (256-274): Different number of components on the left hand side (3) than on the right hand side (2). +// Warning: (172-191): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (201-226): Different number of components on the left hand side (3) than on the right hand side (2). +// Warning: (236-255): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (265-290): Different number of components on the left hand side (3) than on the right hand side (2). // Warning: (121-137): No visibility specified. Defaulting to "public". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol index 526ff4e8..0ccbb327 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/240_multi_variable_declaration_wildcards_fail_1.sol @@ -1,9 +1,7 @@ contract C { function one() public returns (uint); - function f() public { var (a, b, ) = one(); } + function f() public { (uint a, uint b, ) = one(); } } // ---- -// Warning: (86-87): Use of the "var" keyword is deprecated. -// Warning: (89-90): Use of the "var" keyword is deprecated. -// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (81-101): Not enough components (1) in value to assign all variables (2). +// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (81-107): Not enough components (1) in value to assign all variables (2). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol index e41edb64..8d5de125 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/241_multi_variable_declaration_wildcards_fail_2.sol @@ -1,8 +1,7 @@ contract C { function one() public returns (uint); - function f() public { var (a, , ) = one(); } + function f() public { (uint a, , ) = one(); } } // ---- -// Warning: (86-87): Use of the "var" keyword is deprecated. -// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (81-100): Not enough components (1) in value to assign all variables (2). +// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (81-101): Not enough components (1) in value to assign all variables (2). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol index 202b79c6..993df9b9 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/242_multi_variable_declaration_wildcards_fail_3.sol @@ -1,8 +1,7 @@ contract C { function one() public returns (uint); - function f() public { var (, , a) = one(); } + function f() public { (, , uint a) = one(); } } // ---- -// Warning: (90-91): Use of the "var" keyword is deprecated. -// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (81-100): Not enough components (1) in value to assign all variables (2). +// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (81-101): Not enough components (1) in value to assign all variables (2). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol index 79f2f3b5..0697b789 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/243_multi_variable_declaration_wildcards_fail_4.sol @@ -1,9 +1,7 @@ contract C { function one() public returns (uint); - function f() public { var (, a, b) = one(); } + function f() public { (, uint a, uint b) = one(); } } // ---- -// Warning: (88-89): Use of the "var" keyword is deprecated. -// Warning: (91-92): Use of the "var" keyword is deprecated. -// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1). -// TypeError: (81-101): Not enough components (1) in value to assign all variables (2). +// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1). +// TypeError: (81-107): Not enough components (1) in value to assign all variables (2). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol index 43553af9..3112f67a 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/244_tuples.sol @@ -1,17 +1,13 @@ contract C { function f() public { uint a = (1); - var (b,) = (uint8(1),); - var (c,d) = (uint32(1), 2 + a); - var (e,) = (uint64(1), 2, b); + (uint b,) = (uint8(1),); + (uint c, uint d) = (uint32(1), 2 + a); + (uint e,) = (uint64(1), 2, b); a;b;c;d;e; } } // ---- -// Warning: (74-75): Use of the "var" keyword is deprecated. -// Warning: (106-107): Use of the "var" keyword is deprecated. -// Warning: (108-109): Use of the "var" keyword is deprecated. -// Warning: (146-147): Use of the "var" keyword is deprecated. -// Warning: (69-91): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (141-169): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (17-195): Function state mutability can be restricted to pure +// Warning: (69-92): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (149-178): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (17-204): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol index 734ba09c..cc5953db 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/247_multi_variable_declaration_wildcards_fail_6.sol @@ -1,10 +1,7 @@ contract C { function two() public returns (uint, uint); - function f() public { var (a, b, c) = two(); } + function f() public { (uint a, uint b, uint c) = two(); } } // ---- -// Warning: (92-93): Use of the "var" keyword is deprecated. -// Warning: (95-96): Use of the "var" keyword is deprecated. -// Warning: (98-99): Use of the "var" keyword is deprecated. -// Warning: (87-108): Different number of components on the left hand side (3) than on the right hand side (2). -// TypeError: (87-108): Not enough components (2) in value to assign all variables (3). +// Warning: (87-119): Different number of components on the left hand side (3) than on the right hand side (2). +// TypeError: (87-119): Not enough components (2) in value to assign all variables (3). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol deleted file mode 100644 index f3e02ecb..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/248_tuple_assignment_from_void_function.sol +++ /dev/null @@ -1,11 +0,0 @@ -contract C { - function f() public { } - function g() public { - var (x,) = (f(), f()); - } -} -// ---- -// Warning: (80-81): Use of the "var" keyword is deprecated. -// Warning: (87-90): Tuple component cannot be empty. -// Warning: (92-95): Tuple component cannot be empty. -// TypeError: (80-81): Cannot declare variable with void (empty tuple) type. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol index 09e357e6..c3cc5232 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/262_bound_function_in_var.sol @@ -3,9 +3,11 @@ contract C { using D for D.s; D.s x; function f(uint a) public returns (uint) { - var g = x.mul; - return g({x: a}); + function (D.s storage, uint) returns (uint) g = x.mul; + g(x, a); + g(a); } } // ---- -// Warning: (218-223): Use of the "var" keyword is deprecated. +// TypeError: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256). +// TypeError: (298-302): Wrong argument count for function call: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol index acb5a0b5..71f43992 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/263_create_memory_arrays.sol @@ -5,12 +5,10 @@ library L { contract C { function f(uint size) public { L.S[][] memory x = new L.S[][](10); - var y = new uint[](20); - var z = new bytes(size); + uint[] memory y = new uint[](20); + bytes memory z = new bytes(size); x;y;z; } } // ---- -// Warning: (205-210): Use of the "var" keyword is deprecated. -// Warning: (237-242): Use of the "var" keyword is deprecated. -// Warning: (122-282): Function state mutability can be restricted to pure +// Warning: (122-301): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol index 8ad26fc0..f0bb557b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/264_mapping_in_memory_array.sol @@ -1,8 +1,7 @@ contract C { function f(uint size) public { - var x = new mapping(uint => uint)[](4); + mapping(uint => uint) x = new mapping(uint => uint)[](4); } } // ---- -// Warning: (56-61): Use of the "var" keyword is deprecated. -// TypeError: (68-91): Type cannot live outside storage. +// TypeError: (86-109): Type cannot live outside storage. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol index 1dd81fde..c4b2c692 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol @@ -1,8 +1,7 @@ contract C { function f(uint size) public { - var x = new uint(7); + uint x = new uint(7); } } // ---- -// Warning: (56-61): Use of the "var" keyword is deprecated. -// TypeError: (64-72): Contract or array type expected. +// TypeError: (65-73): Contract or array type expected. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol index ea3556de..078255e3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/266_invalid_args_creating_memory_array.sol @@ -1,8 +1,7 @@ contract C { function f(uint size) public { - var x = new uint[](); + uint[] memory x = new uint[](); } } // ---- -// Warning: (56-61): Use of the "var" keyword is deprecated. -// TypeError: (64-76): Wrong argument count for function call: 0 arguments given but expected 1. +// TypeError: (74-86): Wrong argument count for function call: 0 arguments given but expected 1. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol index 9a169468..35671e6f 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/267_invalid_args_creating_struct.sol @@ -2,9 +2,8 @@ contract C { struct S { uint a; uint b; } function f() public { - var s = S({a: 1}); + S memory s = S({a: 1}); } } // ---- -// Warning: (81-86): Use of the "var" keyword is deprecated. -// TypeError: (89-98): Wrong argument count for struct constructor: 1 arguments given but expected 2. +// TypeError: (94-103): Wrong argument count for struct constructor: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol index 4075f6f3..41e72d60 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol @@ -25,7 +25,7 @@ contract C { h += 1; // Avoid unused var warning // string literal - var i = true ? "hello" : "world"; + string memory i = true ? "hello" : "world"; i = "used"; //Avoid unused var warning } function f2() public { @@ -38,18 +38,18 @@ contract C { // array byte[2] memory a; byte[2] memory b; - var k = true ? a : b; + byte[2] memory k = true ? a : b; k[0] = byte(0); //Avoid unused var warning bytes memory e; bytes memory f; - var l = true ? e : f; + bytes memory l = true ? e : f; l[0] = byte(0); // Avoid unused var warning // fixed bytes bytes2 c; bytes2 d; - var m = true ? c : d; + bytes2 m = true ? c : d; m &= m; } @@ -60,7 +60,7 @@ contract C { struct_x = true ? struct_x : struct_y; // function - var r = true ? fun_x : fun_y; + function () r = true ? fun_x : fun_y; r(); // Avoid unused var warning // enum small enum_x; @@ -68,13 +68,13 @@ contract C { enum_x = true ? enum_x : enum_y; // tuple - var (n, o) = true ? (1, 2) : (3, 4); + (uint n, uint o) = true ? (1, 2) : (3, 4); (n, o) = (o, n); // Avoid unused var warning // mapping - var p = true ? table1 : table2; + mapping(uint8 => uint8) p = true ? table1 : table2; p[0] = 0; // Avoid unused var warning // typetype - var q = true ? uint32(1) : uint32(2); + uint32 q = true ? uint32(1) : uint32(2); q += 1; // Avoid unused var warning // modifier doesn't fit in here @@ -84,17 +84,8 @@ contract C { } } // ---- -// Warning: (546-551): Use of the "var" keyword is deprecated. -// Warning: (878-883): Use of the "var" keyword is deprecated. -// Warning: (1008-1013): Use of the "var" keyword is deprecated. -// Warning: (1150-1155): Use of the "var" keyword is deprecated. -// Warning: (1357-1362): Use of the "var" keyword is deprecated. -// Warning: (1560-1561): Use of the "var" keyword is deprecated. -// Warning: (1563-1564): Use of the "var" keyword is deprecated. -// Warning: (1672-1677): Use of the "var" keyword is deprecated. -// Warning: (1778-1783): Use of the "var" keyword is deprecated. -// Warning: (984-998): This declaration shadows an existing declaration. +// Warning: (1005-1019): This declaration shadows an existing declaration. // Warning: (90-116): Function state mutability can be restricted to pure // Warning: (121-147): Function state mutability can be restricted to pure -// Warning: (257-632): Function state mutability can be restricted to pure -// Warning: (637-1194): Function state mutability can be restricted to pure +// Warning: (257-642): Function state mutability can be restricted to pure +// Warning: (647-1227): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol index cfaba794..0fd5f331 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/333_fixed_point_casting_exponents_15.sol @@ -1,9 +1,7 @@ contract test { function f() public { - var a = 3 ** ufixed(1.5); + ufixed a = 3 ** ufixed(1.5); } } // ---- -// Warning: (50-55): Use of the "var" keyword is deprecated. -// TypeError: (58-74): Operator ** not compatible with types int_const 3 and ufixed128x18 -// Warning: (50-74): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol index 7d2716fd..03d10f7c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/334_fixed_point_casting_exponents_neg.sol @@ -1,9 +1,7 @@ contract test { function f() public { - var c = 42 ** fixed(-1/4); + ufixed c = 42 ** fixed(-1/4); } } // ---- -// Warning: (50-55): Use of the "var" keyword is deprecated. -// TypeError: (58-75): Operator ** not compatible with types int_const 42 and fixed128x18 -// Warning: (50-75): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. +// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18 diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol deleted file mode 100644 index dac35a54..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/335_var_capable_of_holding_constant_rationals.sol +++ /dev/null @@ -1,16 +0,0 @@ -contract test { - function f() public { - var a = 0.12345678; - var b = 12345678.352; - var c = 0.00000009; - a; b; c; - } -} -// ---- -// Warning: (50-55): Use of the "var" keyword is deprecated. -// Warning: (78-83): Use of the "var" keyword is deprecated. -// Warning: (108-113): Use of the "var" keyword is deprecated. -// Warning: (50-68): The type of this variable was inferred as ufixed24x8. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (78-98): The type of this variable was inferred as ufixed40x3. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (108-126): The type of this variable was inferred as ufixed8x8. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (20-150): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol deleted file mode 100644 index 2f781a5d..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/336_var_and_rational_with_tuple.sol +++ /dev/null @@ -1,12 +0,0 @@ -contract test { - function f() public { - var (a, b) = (.5, 1/3); - a; b; - } -} -// ---- -// Warning: (55-56): Use of the "var" keyword is deprecated. -// Warning: (58-59): Use of the "var" keyword is deprecated. -// Warning: (50-72): The type of this variable was inferred as ufixed8x1. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (50-72): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (20-93): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol deleted file mode 100644 index ef2b912c..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/337_var_handle_divided_integers.sol +++ /dev/null @@ -1,10 +0,0 @@ -contract test { - function f() public { - var x = 1/3; - } -} -// ---- -// Warning: (50-55): Use of the "var" keyword is deprecated. -// Warning: (50-61): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (50-55): Unused local variable. -// Warning: (20-68): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol index 221d513e..81cc7d0d 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol @@ -1,9 +1,6 @@ contract C { function f() public { - var x = 0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E; - x.send(2); + (0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E).transfer(2); } } // ---- -// Warning: (47-52): Use of the "var" keyword is deprecated. -// Warning: (107-116): Failure condition of 'send' ignored. Consider using 'transfer' instead. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol index 2b96a7ee..5f601db2 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol @@ -1,10 +1,8 @@ contract C { function h() pure external { } - function f() view external returns (bytes4) { - var g = this.h; - return g.selector; + function f() pure external returns (bytes4) { + return this.h.selector; } } // ---- -// Warning: (110-115): Use of the "var" keyword is deprecated. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol index ed6c01c5..9ee7d9bb 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/490_function_types_selector_7.sol @@ -3,9 +3,7 @@ contract C { } function f() view external returns (bytes4) { function () pure external g = this.h; - var i = g; - return i.selector; + return g.selector; } } // ---- -// Warning: (156-161): Use of the "var" keyword is deprecated. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol index 4f185e4d..35f4639e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol @@ -9,14 +9,13 @@ contract C { } contract D { function f() { - var x = (new C()).balance(); + uint x = (new C()).balance(); x; (new C()).transfer(5); } } // ---- -// Warning: (282-287): Use of the "var" keyword is deprecated. // Warning: (17-127): No visibility specified. Defaulting to "public". // Warning: (132-239): No visibility specified. Defaulting to "public". -// Warning: (259-358): No visibility specified. Defaulting to "public". +// Warning: (259-359): No visibility specified. Defaulting to "public". // Warning: (17-127): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/parsing/if_statement.sol b/test/libsolidity/syntaxTests/parsing/if_statement.sol index 0819cb9f..451fba1f 100644 --- a/test/libsolidity/syntaxTests/parsing/if_statement.sol +++ b/test/libsolidity/syntaxTests/parsing/if_statement.sol @@ -1,11 +1,9 @@ contract test { function fun(uint256 a) returns (uint) { - if (a >= 8) { return 2; } else { var b = 7; } + if (a >= 8) { return 2; } else { uint b = 7; } } } // ---- -// Warning: (102-107): Use of the "var" keyword is deprecated. -// Warning: (102-111): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (20-120): No visibility specified. Defaulting to "public". -// Warning: (102-107): Unused local variable. -// Warning: (20-120): Function state mutability can be restricted to pure +// Warning: (20-121): No visibility specified. Defaulting to "public". +// Warning: (102-108): Unused local variable. +// Warning: (20-121): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol index 818999df..1984ed36 100644 --- a/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol +++ b/test/libsolidity/syntaxTests/parsing/multi_variable_declarations.sol @@ -1,29 +1,15 @@ contract C { - function f() { - var (a,b,c) = g(); - var (d) = 2; - var (,e) = 3; - var (f,) = 4; - var (x,,) = g(); - var (,y,) = g(); - var () = g(); - var (,,) = g(); + function f() pure public { + (uint a, uint b, uint c) = g(); + (uint d) = 2; + (, uint e) = 3; + (uint h,) = 4; + (uint x,,) = g(); + (, uint y,) = g(); + a; b; c; d; e; h; x; y; } - function g() returns (uint, uint, uint) {} + function g() pure public returns (uint, uint, uint) {} } // ---- -// Warning: (36-37): Use of the "var" keyword is deprecated. -// Warning: (38-39): Use of the "var" keyword is deprecated. -// Warning: (40-41): Use of the "var" keyword is deprecated. -// Warning: (57-58): Use of the "var" keyword is deprecated. -// Warning: (73-74): Use of the "var" keyword is deprecated. -// Warning: (88-89): Use of the "var" keyword is deprecated. -// Warning: (104-105): Use of the "var" keyword is deprecated. -// Warning: (124-125): Use of the "var" keyword is deprecated. -// Warning: (88-89): This declaration shadows an existing declaration. -// Warning: (52-63): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (67-79): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (67-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (83-95): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (83-95): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// TypeError: (137-149): Too many components (3) in value for variable assignment (0) needed +// Warning: (93-107): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (111-124): Different number of components on the left hand side (2) than on the right hand side (1). diff --git a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol index 72546dc0..e331440d 100644 --- a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol +++ b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol @@ -1,11 +1,9 @@ contract c { function fun() returns (uint r) { - var _ = 8; + uint _ = 8; return _ + 1; } } // ---- -// Warning: (59-64): Use of the "var" keyword is deprecated. -// Warning: (59-68): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (17-97): No visibility specified. Defaulting to "public". -// Warning: (17-97): Function state mutability can be restricted to pure +// Warning: (17-98): No visibility specified. Defaulting to "public". +// Warning: (17-98): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol index 6f739740..d691da44 100644 --- a/test/libsolidity/syntaxTests/parsing/tuples.sol +++ b/test/libsolidity/syntaxTests/parsing/tuples.sol @@ -1,24 +1,17 @@ contract C { function f() { uint a = (1); - var (b,) = (1,); - var (c,d) = (1, 2 + a); - var (e,) = (1, 2, b); + (uint b,) = (1,); + (uint c, uint d) = (1, 2 + a); + (uint e,) = (1, 2, b); (a) = 3; } } // ---- -// Warning: (52-53): Use of the "var" keyword is deprecated. -// Warning: (71-72): Use of the "var" keyword is deprecated. -// Warning: (73-74): Use of the "var" keyword is deprecated. -// Warning: (97-98): Use of the "var" keyword is deprecated. -// Warning: (47-62): Different number of components on the left hand side (2) than on the right hand side (1). -// Warning: (47-62): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (66-88): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (92-112): Different number of components on the left hand side (2) than on the right hand side (3). -// Warning: (92-112): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning. -// Warning: (14-127): No visibility specified. Defaulting to "public". -// Warning: (71-72): Unused local variable. -// Warning: (73-74): Unused local variable. -// Warning: (97-98): Unused local variable. -// Warning: (14-127): Function state mutability can be restricted to pure +// Warning: (47-63): Different number of components on the left hand side (2) than on the right hand side (1). +// Warning: (100-121): Different number of components on the left hand side (2) than on the right hand side (3). +// Warning: (14-136): No visibility specified. Defaulting to "public". +// Warning: (68-74): Unused local variable. +// Warning: (76-82): Unused local variable. +// Warning: (101-107): Unused local variable. +// Warning: (14-136): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol b/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol index 1d243c7c..23484567 100644 --- a/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol +++ b/test/libsolidity/syntaxTests/tupleAssignments/warn_fill_vardecl.sol @@ -1,11 +1,8 @@ contract C { function f() public pure returns (uint, uint, uint, uint) { - // Can later be replaced by (uint a, uint b,) = f(); - var (a,b,) = f(); + (uint a, uint b,) = f(); a; b; } } // ---- -// Warning: (136-137): Use of the "var" keyword is deprecated. -// Warning: (138-139): Use of the "var" keyword is deprecated. -// Warning: (131-147): Different number of components on the left hand side (3) than on the right hand side (4). +// Warning: (76-99): Different number of components on the left hand side (3) than on the right hand side (4). |