aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md1
-rw-r--r--docs/contributing.rst4
-rw-r--r--docs/frequently-asked-questions.rst23
-rw-r--r--docs/layout-of-source-files.rst2
-rw-r--r--docs/style-guide.rst61
-rw-r--r--libsolidity/analysis/StaticAnalyzer.cpp28
-rw-r--r--libsolidity/analysis/ViewPureChecker.cpp1
-rwxr-xr-xscripts/tests.sh21
-rw-r--r--test/RPCSession.cpp35
-rw-r--r--test/RPCSession.h3
-rw-r--r--test/libsolidity/GasMeter.cpp12
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp3
-rw-r--r--test/libsolidity/syntaxTests/functionTypes/valid_function_type_variables.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/009_type_checking_function_call.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/049_function_external_call_allowed_conversion.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/051_function_internal_allowed_conversion.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/055_inheritance_diamond_basic.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/057_legal_override_direct.sol3
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/058_legal_override_indirect.sol3
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/096_access_to_default_function_visibility.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/216_function_argument_storage_to_mem.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/256_using_for_overload.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/260_library_memory_struct.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol2
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/345_unused_return_value.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/437_warn_unused_function_parameter.sol1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/439_warn_unused_return_parameter.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_function.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/external_function.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_normal_comments.sol3
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/library_simple.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/modifier_invocation.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol12
-rw-r--r--test/libsolidity/syntaxTests/parsing/no_function_params.sol1
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_function_param.sol3
-rw-r--r--test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol3
-rw-r--r--test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol1
-rwxr-xr-xtest/solcjsTests.sh2
48 files changed, 98 insertions, 173 deletions
diff --git a/Changelog.md b/Changelog.md
index 7e60ff38..838fd8be 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,6 +9,7 @@ Compiler Features:
* Code Generator: Use codecopy for string constants more aggressively.
* Code Generator: Use binary search for dispatch function if more efficient. The size/speed tradeoff can be tuned using ``--optimize-runs``.
* SMTChecker: Support mathematical and cryptographic functions in an uninterpreted way.
+ * Static Analyzer: Do not warn about unused variables or state mutability for functions with an empty body.
* Type Checker: Add an additional reason to be displayed when type conversion fails.
* Yul: Support object access via ``datasize``, ``dataoffset`` and ``datacopy`` in standalone assembly mode.
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 12dea7d1..47d0d070 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -90,7 +90,7 @@ The option ``--no-smt`` disables the tests that require ``libz3`` and
``--no-ipc`` disables those that require ``aleth``.
If you want to run the ipc tests (that test the semantics of the generated code),
-you need to install `aleth <https://github.com/ethereum/cpp-ethereum/releases/download/solidityTester/aleth_2018-06-20_artful>`_ and run it in testing mode: ``aleth --test -d /tmp/testeth`` (make sure to rename it).
+you need to install `aleth <https://github.com/ethereum/aleth/releases/download/v1.5.0-alpha.7/aleth-1.5.0-alpha.7-linux-x86_64.tar.gz>`_ and run it in testing mode: ``aleth --test -d /tmp/testeth`` (make sure to rename it).
To run the actual tests, use: ``./scripts/soltest.sh --ipcpath /tmp/testeth/geth.ipc``.
@@ -124,7 +124,7 @@ The CI runs additional tests (including ``solc-js`` and testing third party Soli
You can not use some versions of ``aleth`` for testing. We suggest using
the same version that the Solidity continuous integration tests use.
- Currently the CI uses ``d661ac4fec0aeffbedcdc195f67f5ded0c798278`` of ``aleth``.
+ Currently the CI uses version ``1.5.0-alpha.7`` of ``aleth``.
Writing and running syntax tests
--------------------------------
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
index e58db133..a4ef3684 100644
--- a/docs/frequently-asked-questions.rst
+++ b/docs/frequently-asked-questions.rst
@@ -9,29 +9,6 @@ This list was originally compiled by `fivedogit <mailto:fivedogit@gmail.com>`_.
Basic Questions
***************
-Create a contract that can be killed and return funds
-=====================================================
-
-First, a word of warning: Killing contracts sounds like a good idea, because "cleaning up"
-is always good, but as seen above, it does not really clean up. Furthermore,
-if Ether is sent to removed contracts, the Ether will be forever lost.
-
-If you want to deactivate your contracts, it is preferable to **disable** them by changing some
-internal state which causes all functions to throw. This will make it impossible
-to use the contract and ether sent to the contract will be returned automatically.
-
-Now to answering the question: Inside a constructor, ``msg.sender`` is the
-creator. Save it. Then ``selfdestruct(creator);`` to kill and return funds.
-
-`example <https://github.com/fivedogit/solidity-baby-steps/blob/master/contracts/05_greeter.sol>`_
-
-Note that if you ``import "mortal"`` at the top of your contracts and declare
-``contract SomeContract is mortal { ...`` and compile with a compiler that already
-has it (which includes `Remix <https://remix.ethereum.org/>`_), then
-``kill()`` is taken care of for you. Once a contract is "mortal", then you can
-``contractname.kill.sendTransaction({from:eth.coinbase})``, just the same as my
-examples.
-
If I return an ``enum``, I only get integer values in web3.js. How to get the named values?
===========================================================================================
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst
index ad84b200..fa36fc6a 100644
--- a/docs/layout-of-source-files.rst
+++ b/docs/layout-of-source-files.rst
@@ -267,7 +267,7 @@ Single-line comments (``//``) and multi-line comments (``/*...*/``) are possible
(these are NEL, LS and PS), it will lead to a parser error.
Additionally, there is another type of comment called a natspec comment,
-for which the documentation is not yet written. They are written with a
+which is detailed in the :ref:`style guide<natspec>`. They are written with a
triple slash (``///``) or a double asterisk block(``/** ... */``) and
they should be used directly above function declarations or statements.
You can use `Doxygen <https://en.wikipedia.org/wiki/Doxygen>`_-style tags inside these comments to document
diff --git a/docs/style-guide.rst b/docs/style-guide.rst
index 68fee871..bf1be93e 100644
--- a/docs/style-guide.rst
+++ b/docs/style-guide.rst
@@ -1093,3 +1093,64 @@ General Recommendations
=======================
TODO
+
+.. _natspec:
+
+*******
+NatSpec
+*******
+
+Solidity contracts can have a form of comments that are the basis of the
+Ethereum Natural Language Specification Format.
+
+Add comments above functions or contracts following `doxygen <http://www.doxygen.nl>`_ notation
+of one or multiple lines starting with `///` or a
+multiline comment starting with `/**` and ending with `*/`.
+
+For example, the contract from `a simple smart contract <simple-smart-contract>`_ with the comments
+added looks like the one below::
+
+ pragma solidity >=0.4.0 <0.6.0;
+
+ /// @author The Solidity Team
+ /// @title A simple storage example
+ contract SimpleStorage {
+ uint storedData;
+
+ /// Store `x`.
+ /// @param x the new value to store
+ /// @dev stores the number in the state variable `storedData`
+ function set(uint x) public {
+ storedData = x;
+ }
+
+ /// Return the stored value.
+ /// @dev retrieves the value of the state variable `storedData`
+ /// @return the stored value
+ function get() public view returns (uint) {
+ return storedData;
+ }
+ }
+
+Natspec uses doxygen style tags with some special meaning.
+If no tag is used, then the comment applies to ``@notice``.
+The ``@notice`` tag is the main NatSpec tag and its audience is
+users of the contract who have never seen the source code, so it should make
+as little assumptions about the inner details as possible.
+All tags are optional.
+
++-------------+-------------------------------------------+-------------------------------+
+| Tag | Description | Context |
++=============+===========================================+===============================+
+| ``@title`` | A title that describes the contract | contract, interface |
++-------------+-------------------------------------------+-------------------------------+
+| ``@author`` | The name of the author | contract, interface, function |
++-------------+-------------------------------------------+-------------------------------+
+| ``@notice`` | Explanation of functionality | contract, interface, function |
++-------------+-------------------------------------------+-------------------------------+
+| ``@dev`` | Any extra details | contract, interface, function |
++-------------+-------------------------------------------+-------------------------------+
+| ``@param`` | Parameter type followed by parameter name | function |
++-------------+-------------------------------------------+-------------------------------+
+| ``@return`` | The return value of a contract's function | function |
++-------------+-------------------------------------------+-------------------------------+
diff --git a/libsolidity/analysis/StaticAnalyzer.cpp b/libsolidity/analysis/StaticAnalyzer.cpp
index 38391841..4d0f3461 100644
--- a/libsolidity/analysis/StaticAnalyzer.cpp
+++ b/libsolidity/analysis/StaticAnalyzer.cpp
@@ -63,21 +63,21 @@ bool StaticAnalyzer::visit(FunctionDefinition const& _function)
void StaticAnalyzer::endVisit(FunctionDefinition const&)
{
- m_currentFunction = nullptr;
- m_constructor = false;
- for (auto const& var: m_localVarUseCount)
- if (var.second == 0)
- {
- if (var.first.second->isCallableParameter())
- m_errorReporter.warning(
- var.first.second->location(),
- "Unused function parameter. Remove or comment out the variable name to silence this warning."
- );
- else
- m_errorReporter.warning(var.first.second->location(), "Unused local variable.");
- }
-
+ if (m_currentFunction && !m_currentFunction->body().statements().empty())
+ for (auto const& var: m_localVarUseCount)
+ if (var.second == 0)
+ {
+ if (var.first.second->isCallableParameter())
+ m_errorReporter.warning(
+ var.first.second->location(),
+ "Unused function parameter. Remove or comment out the variable name to silence this warning."
+ );
+ else
+ m_errorReporter.warning(var.first.second->location(), "Unused local variable.");
+ }
m_localVarUseCount.clear();
+ m_constructor = false;
+ m_currentFunction = nullptr;
}
bool StaticAnalyzer::visit(Identifier const& _identifier)
diff --git a/libsolidity/analysis/ViewPureChecker.cpp b/libsolidity/analysis/ViewPureChecker.cpp
index 1112d682..bd3071b3 100644
--- a/libsolidity/analysis/ViewPureChecker.cpp
+++ b/libsolidity/analysis/ViewPureChecker.cpp
@@ -156,6 +156,7 @@ void ViewPureChecker::endVisit(FunctionDefinition const& _funDef)
m_bestMutabilityAndLocation.mutability < _funDef.stateMutability() &&
_funDef.stateMutability() != StateMutability::Payable &&
_funDef.isImplemented() &&
+ !_funDef.body().statements().empty() &&
!_funDef.isConstructor() &&
!_funDef.isFallback() &&
!_funDef.annotation().superFunction
diff --git a/scripts/tests.sh b/scripts/tests.sh
index c284c05c..1a8a32cf 100755
--- a/scripts/tests.sh
+++ b/scripts/tests.sh
@@ -130,21 +130,14 @@ function download_aleth()
elif [ -z $CI ]; then
ALETH_PATH="aleth"
else
- # Any time the hash is updated here, the "Running compiler tests" section should also be updated.
mkdir -p /tmp/test
- if grep -i trusty /etc/lsb-release >/dev/null 2>&1
- then
- # built from d661ac4fec0aeffbedcdc195f67f5ded0c798278 at 2018-06-20
- ALETH_BINARY=aleth_2018-06-20_trusty
- ALETH_HASH="54b8a5455e45b295e3a962f353ff8f1580ed106c"
- else
- # built from d661ac4fec0aeffbedcdc195f67f5ded0c798278 at 2018-06-20
- ALETH_BINARY=aleth_2018-06-20_artful
- ALETH_HASH="02e6c4b3d98299885e73f7db6c9e3fbe3d66d444"
- fi
- ALETH_PATH="/tmp/test/aleth"
- wget -q -O $ALETH_PATH https://github.com/ethereum/cpp-ethereum/releases/download/solidityTester/$ALETH_BINARY
- test "$(shasum $ALETH_PATH)" = "$ALETH_HASH $ALETH_PATH"
+ # Any time the hash is updated here, the "Running compiler tests" section should also be updated.
+ ALETH_HASH="8ce2f00539d2fd8b5f093d854c6999424f7494ff"
+ ALETH_VERSION=1.5.0-alpha.7
+ wget -q -O /tmp/test/aleth.tar.gz https://github.com/ethereum/aleth/releases/download/v${ALETH_VERSION}/aleth-${ALETH_VERSION}-linux-x86_64.tar.gz
+ test "$(shasum /tmp/test/aleth.tar.gz)" = "$ALETH_HASH /tmp/test/aleth.tar.gz"
+ tar -xf /tmp/test/aleth.tar.gz -C /tmp/test
+ ALETH_PATH="/tmp/test/bin/aleth"
sync
chmod +x $ALETH_PATH
sync # Otherwise we might get a "text file busy" error
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index 0aae21a7..60848118 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -296,40 +296,7 @@ void RPCSession::test_mineBlocks(int _number)
{
u256 startBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString()));
BOOST_REQUIRE(rpcCall("test_mineBlocks", { to_string(_number) }, true) == true);
-
- // We auto-calibrate the time it takes to mine the transaction.
- // It would be better to go without polling, but that would probably need a change to the test client
-
- auto startTime = std::chrono::steady_clock::now();
- unsigned sleepTime = m_sleepTime;
- size_t tries = 0;
- for (; ; ++tries)
- {
- std::this_thread::sleep_for(chrono::milliseconds(sleepTime));
- auto endTime = std::chrono::steady_clock::now();
- unsigned timeSpent = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count();
- if (timeSpent > m_maxMiningTime)
- BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
- if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number)
- break;
- else
- sleepTime *= 2;
- }
- if (tries > 1)
- {
- m_successfulMineRuns = 0;
- m_sleepTime += 2;
- }
- else if (tries == 1)
- {
- m_successfulMineRuns++;
- if (m_successfulMineRuns > 5)
- {
- m_successfulMineRuns = 0;
- if (m_sleepTime > 2)
- m_sleepTime--;
- }
- }
+ BOOST_REQUIRE(fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) == startBlock + _number);
}
void RPCSession::test_modifyTimestamp(size_t _timestamp)
diff --git a/test/RPCSession.h b/test/RPCSession.h
index 6e1391b4..92f9da4a 100644
--- a/test/RPCSession.h
+++ b/test/RPCSession.h
@@ -136,9 +136,6 @@ private:
IPCSocket m_ipcSocket;
size_t m_rpcSequence = 1;
- unsigned m_maxMiningTime = 6000000; // 600 seconds
- unsigned m_sleepTime = 10; // 10 milliseconds
- unsigned m_successfulMineRuns = 0;
bool m_receiptHasStatusField = false;
std::vector<std::string> m_accounts;
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index 5535bd74..12c22604 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -62,7 +62,7 @@ public:
);
}
- void testCreationTimeGas(string const& _sourceCode)
+ void testCreationTimeGas(string const& _sourceCode, u256 const& _tolerance = u256(0))
{
compileAndRun(_sourceCode);
auto state = make_shared<KnownState>();
@@ -75,12 +75,13 @@ public:
gas += gasForTransaction(m_compiler.object(m_compiler.lastContractName()).bytecode, true);
BOOST_REQUIRE(!gas.isInfinite);
- BOOST_CHECK_EQUAL(gas.value, m_gasUsed);
+ BOOST_CHECK_LE(m_gasUsed, gas.value);
+ BOOST_CHECK_LE(gas.value - _tolerance, m_gasUsed);
}
/// Compares the gas computed by PathGasMeter for the given signature (but unknown arguments)
/// against the actual gas usage computed by the VM on the given set of argument variants.
- void testRunTimeGas(string const& _sig, vector<bytes> _argumentVariants)
+ void testRunTimeGas(string const& _sig, vector<bytes> _argumentVariants, u256 const& _tolerance = u256(0))
{
u256 gasUsed = 0;
GasMeter::GasConsumption gas;
@@ -98,7 +99,8 @@ public:
_sig
);
BOOST_REQUIRE(!gas.isInfinite);
- BOOST_CHECK_EQUAL(gas.value, m_gasUsed);
+ BOOST_CHECK_LE(m_gasUsed, gas.value);
+ BOOST_CHECK_LE(gas.value - _tolerance, m_gasUsed);
}
static GasMeter::GasConsumption gasForTransaction(bytes const& _data, bool _isCreation)
@@ -186,7 +188,7 @@ BOOST_AUTO_TEST_CASE(updating_store)
}
}
)";
- testCreationTimeGas(sourceCode);
+ testCreationTimeGas(sourceCode, m_evmVersion < EVMVersion::constantinople() ? u256(0) : u256(9600));
}
BOOST_AUTO_TEST_CASE(branches)
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index dfa60fc5..8d219d16 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -3039,7 +3039,8 @@ BOOST_AUTO_TEST_CASE(gaslimit)
}
)";
compileAndRun(sourceCode);
- ABI_CHECK(callContractFunction("f()"), encodeArgs(gasLimit()));
+ auto result = callContractFunction("f()");
+ ABI_CHECK(result, encodeArgs(gasLimit()));
}
BOOST_AUTO_TEST_CASE(gasprice)
diff --git a/test/libsolidity/syntaxTests/functionTypes/valid_function_type_variables.sol b/test/libsolidity/syntaxTests/functionTypes/valid_function_type_variables.sol
index e7d2c9a9..65198706 100644
--- a/test/libsolidity/syntaxTests/functionTypes/valid_function_type_variables.sol
+++ b/test/libsolidity/syntaxTests/functionTypes/valid_function_type_variables.sol
@@ -18,9 +18,3 @@ contract test {
function(uint) pure internal h = fh;
}
// ----
-// Warning: (20-47): Function state mutability can be restricted to pure
-// Warning: (52-81): Function state mutability can be restricted to pure
-// Warning: (86-115): Function state mutability can be restricted to pure
-// Warning: (120-149): Function state mutability can be restricted to pure
-// Warning: (154-183): Function state mutability can be restricted to pure
-// Warning: (188-217): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol
index e112e16c..a554d3ab 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol
@@ -3,4 +3,3 @@ contract test {
function f() public {}
}
// ----
-// Warning: (53-75): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/009_type_checking_function_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/009_type_checking_function_call.sol
index abe2beac..3872b1c3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/009_type_checking_function_call.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/009_type_checking_function_call.sol
@@ -3,4 +3,3 @@ contract test {
function g(uint256, bool) public returns (uint256) { }
}
// ----
-// Warning: (88-142): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/049_function_external_call_allowed_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/049_function_external_call_allowed_conversion.sol
index ec72adeb..bda0b946 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/049_function_external_call_allowed_conversion.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/049_function_external_call_allowed_conversion.sol
@@ -7,5 +7,3 @@ contract Test {
function g (C c) external {}
}
// ----
-// Warning: (125-128): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (113-141): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/051_function_internal_allowed_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/051_function_internal_allowed_conversion.sol
index aedc7b0b..5a9616ac 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/051_function_internal_allowed_conversion.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/051_function_internal_allowed_conversion.sol
@@ -9,5 +9,3 @@ contract Test {
}
}
// ----
-// Warning: (68-71): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (56-82): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/055_inheritance_diamond_basic.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/055_inheritance_diamond_basic.sol
index c07e59e2..2e235ee0 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/055_inheritance_diamond_basic.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/055_inheritance_diamond_basic.sol
@@ -5,5 +5,3 @@ contract derived is root, inter2, inter1 {
function g() public { f(); rootFunction(); }
}
// ----
-// Warning: (16-49): Function state mutability can be restricted to pure
-// Warning: (129-151): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/057_legal_override_direct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/057_legal_override_direct.sol
index 062507ee..bf6459cb 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/057_legal_override_direct.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/057_legal_override_direct.sol
@@ -1,6 +1,3 @@
contract B { function f() public {} }
contract C is B { function f(uint i) public {} }
// ----
-// Warning: (67-73): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (13-35): Function state mutability can be restricted to pure
-// Warning: (56-84): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/058_legal_override_indirect.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/058_legal_override_indirect.sol
index f59da472..461bbbf2 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/058_legal_override_indirect.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/058_legal_override_indirect.sol
@@ -2,6 +2,3 @@ contract A { function f(uint a) public {} }
contract B { function f() public {} }
contract C is A, B { }
// ----
-// Warning: (24-30): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (13-41): Function state mutability can be restricted to pure
-// Warning: (57-79): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol
index c7e42238..ce3b622b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/060_complex_inheritance.sol
@@ -3,4 +3,3 @@ contract B { function f() public {} function g() public returns (uint8) {} }
contract C is A, B { }
// ----
// Warning: (35-42): Unused local variable.
-// Warning: (95-133): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol
index 8ebb46aa..31be70ca 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/061_missing_base_constructor_arguments.sol
@@ -1,4 +1,3 @@
contract A { constructor(uint a) public { } }
contract B is A { }
// ----
-// Warning: (25-31): Unused function parameter. Remove or comment out the variable name to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol
index 8ebb46aa..31be70ca 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/062_base_constructor_arguments_override.sol
@@ -1,4 +1,3 @@
contract A { constructor(uint a) public { } }
contract B is A { }
// ----
-// Warning: (25-31): Unused function parameter. Remove or comment out the variable name to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/096_access_to_default_function_visibility.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/096_access_to_default_function_visibility.sol
index 9251df73..4f89e69e 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/096_access_to_default_function_visibility.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/096_access_to_default_function_visibility.sol
@@ -5,4 +5,3 @@ contract d {
function g() public { c(0).f(); }
}
// ----
-// Warning: (17-39): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol
index 824543ef..af392402 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol
@@ -2,4 +2,3 @@ contract test {
function f(uint) public { }
}
// ----
-// Warning: (20-47): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol
index a2ffc6e1..b524cd97 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol
@@ -2,4 +2,3 @@ contract test {
function f() public returns (bool) { }
}
// ----
-// Warning: (20-58): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/216_function_argument_storage_to_mem.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/216_function_argument_storage_to_mem.sol
index c5175a41..0f4388d0 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/216_function_argument_storage_to_mem.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/216_function_argument_storage_to_mem.sol
@@ -6,5 +6,3 @@ contract C {
}
}
// ----
-// Warning: (91-106): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (80-122): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/256_using_for_overload.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/256_using_for_overload.sol
index 155281f5..f033b85b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/256_using_for_overload.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/256_using_for_overload.sol
@@ -11,4 +11,3 @@ contract C {
}
}
// ----
-// Warning: (128-189): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/260_library_memory_struct.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/260_library_memory_struct.sol
index 20d8afa5..ee5bcda9 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/260_library_memory_struct.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/260_library_memory_struct.sol
@@ -5,4 +5,3 @@ library c {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
-// Warning: (75-116): Function state mutability can be restricted to pure
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 e9ab08ba..a92c07f3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/288_conditional_with_all_types.sol
@@ -85,7 +85,5 @@ contract C {
}
// ----
// 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-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/345_unused_return_value.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/345_unused_return_value.sol
index 7f640505..109e8dfb 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/345_unused_return_value.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/345_unused_return_value.sol
@@ -5,4 +5,3 @@ contract test {
}
}
// ----
-// Warning: (20-57): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol
index 0032f99e..87a7b28d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/376_inline_assembly_in_modifier.sol
@@ -10,4 +10,3 @@ contract test {
}
}
// ----
-// Warning: (122-151): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
index 2575954e..b4088068 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
@@ -7,4 +7,3 @@ contract C {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
-// Warning: (112-164): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/437_warn_unused_function_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/437_warn_unused_function_parameter.sol
index 8a36eaad..4227cbb9 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/437_warn_unused_function_parameter.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/437_warn_unused_function_parameter.sol
@@ -3,4 +3,3 @@ contract C {
}
}
// ----
-// Warning: (28-34): Unused function parameter. Remove or comment out the variable name to silence this warning.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/439_warn_unused_return_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/439_warn_unused_return_parameter.sol
index b1422c4f..b4c9be35 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/439_warn_unused_return_parameter.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/439_warn_unused_return_parameter.sol
@@ -3,4 +3,3 @@ contract C {
}
}
// ----
-// Warning: (51-57): Unused function parameter. Remove or comment out the variable name to silence this warning.
diff --git a/test/libsolidity/syntaxTests/parsing/empty_function.sol b/test/libsolidity/syntaxTests/parsing/empty_function.sol
index 320a0bcc..3f42e4e3 100644
--- a/test/libsolidity/syntaxTests/parsing/empty_function.sol
+++ b/test/libsolidity/syntaxTests/parsing/empty_function.sol
@@ -3,7 +3,3 @@ contract test {
function functionName(bytes20 arg1, address addr) public view returns (int id) { }
}
// ----
-// Warning: (58-70): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (72-84): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (107-113): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (36-118): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/external_function.sol b/test/libsolidity/syntaxTests/parsing/external_function.sol
index 3aa3ceec..0315b200 100644
--- a/test/libsolidity/syntaxTests/parsing/external_function.sol
+++ b/test/libsolidity/syntaxTests/parsing/external_function.sol
@@ -2,4 +2,3 @@ contract c {
function x() external {}
}
// ----
-// Warning: (17-41): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol b/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
index 94e1e60a..231be9c2 100644
--- a/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
@@ -4,6 +4,3 @@ contract test {
function functionName(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (97-110): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (128-139): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (75-143): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
index 11e77f25..42d8717a 100644
--- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
@@ -3,7 +3,3 @@ contract test {
function (uint, uint) internal returns (uint) f1 = f;
}
// ----
-// Warning: (31-37): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (39-45): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (63-69): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (20-73): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
index 3defb5ea..000c2011 100644
--- a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
@@ -5,9 +5,5 @@ contract test {
}
}
// ----
-// Warning: (31-37): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (39-45): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (63-69): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (108-156): Unused local variable.
-// Warning: (20-73): Function state mutability can be restricted to pure
// Warning: (78-167): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/library_simple.sol b/test/libsolidity/syntaxTests/parsing/library_simple.sol
index 006ff307..c892e3ed 100644
--- a/test/libsolidity/syntaxTests/parsing/library_simple.sol
+++ b/test/libsolidity/syntaxTests/parsing/library_simple.sol
@@ -2,4 +2,3 @@ library Lib {
function f() public { }
}
// ----
-// Warning: (18-41): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol b/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
index cf986efe..6fa007c7 100644
--- a/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
+++ b/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
@@ -4,4 +4,3 @@ contract c {
function f() public mod1(7) mod2 { }
}
// ----
-// Warning: (135-171): Function state mutability can be restricted to view
diff --git a/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol b/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
index 85d9e6a8..ba090c53 100644
--- a/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
+++ b/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
@@ -10,15 +10,3 @@ contract test {
function functionName4(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (97-110): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (128-139): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (203-216): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (234-245): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (304-317): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (335-346): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (410-423): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (441-452): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (74-143): Function state mutability can be restricted to pure
-// Warning: (180-249): Function state mutability can be restricted to pure
-// Warning: (281-350): Function state mutability can be restricted to pure
-// Warning: (387-456): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/no_function_params.sol b/test/libsolidity/syntaxTests/parsing/no_function_params.sol
index 5a024bdb..1f7c85a3 100644
--- a/test/libsolidity/syntaxTests/parsing/no_function_params.sol
+++ b/test/libsolidity/syntaxTests/parsing/no_function_params.sol
@@ -3,4 +3,3 @@ contract test {
function functionName() public {}
}
// ----
-// Warning: (36-69): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param.sol b/test/libsolidity/syntaxTests/parsing/single_function_param.sol
index 955f20f0..8dbac272 100644
--- a/test/libsolidity/syntaxTests/parsing/single_function_param.sol
+++ b/test/libsolidity/syntaxTests/parsing/single_function_param.sol
@@ -3,6 +3,3 @@ contract test {
function functionName(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (58-71): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (89-100): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (36-104): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
index db890b37..24071388 100644
--- a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
+++ b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
@@ -9,6 +9,3 @@ contract c {
}
// ----
// Warning: (58-71): This declaration shadows an existing declaration.
-// Warning: (89-111): Function state mutability can be restricted to pure
-// Warning: (116-144): Function state mutability can be restricted to pure
-// Warning: (149-182): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol b/test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol
index 87719eb3..5ec6d06f 100644
--- a/test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol
+++ b/test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol
@@ -2,4 +2,3 @@ contract C {
function g() view public { }
}
// ----
-// Warning: (17-45): Function state mutability can be restricted to pure
diff --git a/test/solcjsTests.sh b/test/solcjsTests.sh
index e0bbc5df..b9224862 100755
--- a/test/solcjsTests.sh
+++ b/test/solcjsTests.sh
@@ -60,7 +60,7 @@ DIR=$(mktemp -d)
# Update version (needed for some tests)
echo "Updating package.json to version $VERSION"
- npm version --no-git-tag-version $VERSION
+ npm version --allow-same-version --no-git-tag-version $VERSION
echo "Running solc-js tests..."
npm run test