Merge remote-tracking branch 'origin/develop' into breaking

This commit is contained in:
chriseth
2020-07-21 11:35:28 +02:00
627 changed files with 1914 additions and 276 deletions
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Unit tests for Solidity's ABI decoder.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Unit tests for Solidity's ABI encoder.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Unit tests for the solidity compiler ABI JSON Interface output.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <string>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <boost/algorithm/string/replace.hpp>
#include <test/libsolidity/ASTJSONTest.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Framework for testing features from the analysis phase of compiler.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Framework for testing features from the analysis phase of compiler.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Lefteris Karapetsas <lefteris@ethdev.com>
* @date 2015
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/** @file ErrorCheck.cpp
* @author Yoichi Hirai <i@yoichihirai.com>
* @date 2016
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/** @file ErrorCheck.h
* @author Yoichi Hirai <i@yoichihirai.com>
* @date 2016
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Tests that check that the cost of certain operations stay within range.
*/
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2015
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/GasTest.h>
#include <test/Common.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2015
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @date 2017
* Unit tests for libsolc/libsolc.cpp.
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/SMTCheckerJSONTest.h>
#include <test/Common.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/SMTCheckerTest.h>
#include <test/Common.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <chris@ethereum.org>
* @date 2016
+6 -1
View File
@@ -46,7 +46,7 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
m_lineOffset(m_reader.lineNumber()),
m_enforceViaYul(enforceViaYul)
{
string choice = m_reader.stringSetting("compileViaYul", "false");
string choice = m_reader.stringSetting("compileViaYul", "default");
if (choice == "also")
{
m_runWithYul = true;
@@ -64,6 +64,11 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
// Do not try to run via yul if explicitly denied.
m_enforceViaYul = false;
}
else if (choice == "default")
{
m_runWithYul = false;
m_runWithoutYul = true;
}
else
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + choice + "."));
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @author Gav Wood <g@ethdev.com>
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2016
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2014
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2014
+553 -13
View File
@@ -77,7 +77,7 @@ public:
BOOST_REQUIRE(Error::containsErrorOfType(m_compilerStack.errors(), Error::Type::DocstringParsingError));
}
private:
protected:
CompilerStack m_compilerStack;
};
@@ -1281,13 +1281,7 @@ BOOST_AUTO_TEST_CASE(dev_default_inherit_variable)
)";
char const *natspec = R"ABCDEF({
"methods":
{
"x()":
{
"details": "test"
}
}
"methods": { "x()": { "details": "test" } }
})ABCDEF";
char const *natspec1 = R"ABCDEF({
@@ -1322,13 +1316,80 @@ BOOST_AUTO_TEST_CASE(user_default_inherit_variable)
)";
char const *natspec = R"ABCDEF({
"methods":
{
"x()":
{
"notice": "Hello world"
"methods": { "x()": { "notice": "Hello world" } }
})ABCDEF";
checkNatspec(sourceCode, "C", natspec, true);
checkNatspec(sourceCode, "D", natspec, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inherit_variable)
{
char const *sourceCode = R"(
contract B {
function x() virtual external returns (uint) {
return 1;
}
}
contract C {
/// @notice Hello world
/// @dev test
function x() virtual external returns (uint) {
return 1;
}
}
contract D is C, B {
/// @inheritdoc C
uint public override(C, B) x;
}
)";
char const *natspec = R"ABCDEF({
"methods": { "x()": { "details": "test" } }
})ABCDEF";
char const *natspec1 = R"ABCDEF({
"methods" : {},
"stateVariables" :
{
"x" :
{
"details" : "test"
}
}
})ABCDEF";
checkNatspec(sourceCode, "C", natspec, false);
checkNatspec(sourceCode, "D", natspec1, false);
}
BOOST_AUTO_TEST_CASE(user_explicit_inherit_variable)
{
char const *sourceCode = R"(
contract B {
function x() virtual external returns (uint) {
return 1;
}
}
contract C {
/// @notice Hello world
/// @dev test
function x() virtual external returns (uint) {
return 1;
}
}
contract D is C, B {
/// @inheritdoc C
uint public override(C, B) x;
}
)";
char const *natspec = R"ABCDEF({
"methods": { "x()": { "notice": "Hello world" } }
})ABCDEF";
checkNatspec(sourceCode, "C", natspec, true);
@@ -1427,6 +1488,411 @@ BOOST_AUTO_TEST_CASE(user_default_inherit)
checkNatspec(sourceCode, "Token", natspec, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inherit)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 {
function transfer(address to, uint amount) virtual external returns (bool) {
return false;
}
}
contract Token is ERC21, ERC20 {
/// @inheritdoc ERC20
function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "test",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, false);
checkNatspec(sourceCode, "Token", natspec, false);
}
BOOST_AUTO_TEST_CASE(user_explicit_inherit)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 {
function transfer(address to, uint amount) virtual external returns (bool) {
return false;
}
}
contract Token is ERC21, ERC20 {
/// @inheritdoc ERC20
function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "Transfer ``amount`` from ``msg.sender`` to ``to``."
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, true);
checkNatspec(sourceCode, "Token", natspec, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inherit2)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 is ERC20 {
function transfer(address to, uint amount) virtual override external returns (bool) {
return false;
}
}
contract Token is ERC20 {
/// @inheritdoc ERC20
function transfer(address to, uint amount) override external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "test",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, false);
checkNatspec(sourceCode, "ERC21", natspec, false);
checkNatspec(sourceCode, "Token", natspec, false);
}
BOOST_AUTO_TEST_CASE(user_explicit_inherit2)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 is ERC20 {
function transfer(address to, uint amount) virtual override external returns (bool) {
return false;
}
}
contract Token is ERC20 {
/// @inheritdoc ERC20
function transfer(address to, uint amount) override external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "Transfer ``amount`` from ``msg.sender`` to ``to``."
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, true);
checkNatspec(sourceCode, "ERC21", natspec, true);
checkNatspec(sourceCode, "Token", natspec, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial2)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 is ERC20 {
/// @inheritdoc ERC20
/// @dev override dev comment
/// @notice override notice
function transfer(address to, uint amount) virtual override external returns (bool) {
return false;
}
}
contract Token is ERC21 {
function transfer(address to, uint amount) override external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "test",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
char const *natspec2 = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "override dev comment",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, false);
checkNatspec(sourceCode, "Token", natspec2, false);
}
BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial2)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 is ERC20 {
/// @inheritdoc ERC20
/// @dev override dev comment
/// @notice override notice
function transfer(address to, uint amount) virtual override external returns (bool) {
return false;
}
}
contract Token is ERC21 {
function transfer(address to, uint amount) override external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "Transfer ``amount`` from ``msg.sender`` to ``to``."
}
}
})ABCDEF";
char const *natspec2 = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "override notice"
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, true);
checkNatspec(sourceCode, "Token", natspec2, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inherit_partial)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 {
function transfer(address to, uint amount) virtual external returns (bool) {
return false;
}
}
contract Token is ERC21, ERC20 {
/// @inheritdoc ERC20
/// @dev override dev comment
/// @notice override notice
function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "test",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
char const *natspec2 = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "override dev comment",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, false);
checkNatspec(sourceCode, "Token", natspec2, false);
}
BOOST_AUTO_TEST_CASE(user_explicit_inherit_partial)
{
char const *sourceCode = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
contract ERC21 {
function transfer(address to, uint amount) virtual external returns (bool) {
return false;
}
}
contract Token is ERC21, ERC20 {
/// @inheritdoc ERC20
/// @dev override dev comment
/// @notice override notice
function transfer(address to, uint amount) override(ERC21, ERC20) external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "Transfer ``amount`` from ``msg.sender`` to ``to``."
}
}
})ABCDEF";
char const *natspec2 = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"notice": "override notice"
}
}
})ABCDEF";
checkNatspec(sourceCode, "ERC20", natspec, true);
checkNatspec(sourceCode, "Token", natspec2, true);
}
BOOST_AUTO_TEST_CASE(dev_inherit_parameter_mismatch)
{
char const *sourceCode = R"(
@@ -1521,6 +1987,80 @@ BOOST_AUTO_TEST_CASE(user_inherit_parameter_mismatch)
checkNatspec(sourceCode, "Token", natspec2, true);
}
BOOST_AUTO_TEST_CASE(dev_explicit_inehrit_complex)
{
char const *sourceCode1 = R"(
interface ERC20 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer
/// @dev test
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
interface ERC21 {
/// Transfer ``amount`` from ``msg.sender`` to ``to``.
/// @author Programmer2
/// @dev test2
/// @param to address to transfer to
/// @param amount amount to transfer
function transfer(address to, uint amount) external returns (bool);
}
)";
char const *sourceCode2 = R"(
import "Interfaces.sol" as myInterfaces;
contract Token is myInterfaces.ERC20, myInterfaces.ERC21 {
/// @inheritdoc myInterfaces.ERC20
function transfer(address too, uint amount)
override(myInterfaces.ERC20, myInterfaces.ERC21) external returns (bool) {
return false;
}
}
)";
char const *natspec = R"ABCDEF({
"methods":
{
"transfer(address,uint256)":
{
"author": "Programmer",
"details": "test",
"params":
{
"amount": "amount to transfer",
"to": "address to transfer to"
}
}
}
})ABCDEF";
m_compilerStack.reset();
m_compilerStack.setSources({
{"Interfaces.sol", "pragma solidity >=0.0;\n" + std::string(sourceCode1)},
{"Testfile.sol", "pragma solidity >=0.0;\n" + std::string(sourceCode2)}
});
m_compilerStack.setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
BOOST_REQUIRE_MESSAGE(m_compilerStack.parseAndAnalyze(), "Parsing contract failed");
Json::Value generatedDocumentation = m_compilerStack.natspecDev("Token");
Json::Value expectedDocumentation;
util::jsonParseStrict(natspec, expectedDocumentation);
expectedDocumentation["version"] = Json::Value(Natspec::c_natspecVersion);
expectedDocumentation["kind"] = Json::Value("dev");
BOOST_CHECK_MESSAGE(
expectedDocumentation == generatedDocumentation,
"Expected:\n" << expectedDocumentation.toStyledString() <<
"\n but got:\n" << generatedDocumentation.toStyledString()
);
}
}
BOOST_AUTO_TEST_SUITE_END()
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2014
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @author Christian <c@ethdev.com>
* @date 2015
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @date 2017
* Unit tests for interface/StandardCompiler.h.
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/SyntaxTest.h>
#include <test/Common.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
@@ -18,5 +18,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb
@@ -12,5 +12,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc
@@ -45,6 +45,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f0() -> 0x20, 0x0
// f1() -> 0x20, 0x40, 0x1, 0x2
@@ -19,5 +19,7 @@ contract C {
return (b.b, this.g(b));
}
}
// ====
// compileViaYul: also
// ----
// f() -> 11, 11
@@ -20,5 +20,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4
@@ -33,6 +33,8 @@ contract c {
l2 = ids.length;
}
}
// ====
// compileViaYul: also
// ----
// setIDStatic(uint256): 0xb ->
// getID(uint256): 0x2 -> 0xb
@@ -4,5 +4,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 3
@@ -4,6 +4,7 @@ contract C {
return [4][0];
}
}
// ====
// compileViaYul: also
// ----
// f() -> 4
@@ -7,5 +7,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 3, 6
@@ -66,6 +66,8 @@ contract C {
// found expectation comments:
// same offset for both arrays @ ABI_CHECK(
// ====
// compileViaYul: false
// ----
// f1(bytes[1]): 0x20, 0x20, 0x3, hex"0102030000000000000000000000000000000000000000000000000000000000" -> 0x3, 0x1, 0x2, 0x3
// f2(bytes[1],bytes[1]): 0x40, 0xa0, 0x20, 0x3, hex"0102030000000000000000000000000000000000000000000000000000000000", 0x20, 0x2, hex"0102000000000000000000000000000000000000000000000000000000000000" -> 0x3, 0x1, 0x2, 0x3, 0x2, 0x1, 0x2
@@ -7,6 +7,7 @@ contract CalldataTest {
}
}
// ====
// compileViaYul: also
// EVMVersion: >=byzantium
// ----
// tester(bytes): 0x20, 0x08, "abcdefgh" -> "c"
@@ -16,6 +16,8 @@ contract C {
}
}
}
// ====
// compileViaYul: also
// ----
// f((uint8,bytes1)): 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" -> 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" # double check that the valid case goes through #
// f((uint8,bytes1)): 0x1234, hex"5678000000000000000000000000000000000000000000000000000000000000" -> FAILURE
@@ -13,5 +13,7 @@ contract C {
return f(s);
}
}
// ====
// compileViaYul: also
// ----
// f(uint256,(uint256,uint256),uint256): 7, 1, 2, 4 -> 1, 2
@@ -8,5 +8,7 @@ contract C {
correct = r == (0x64 << 248);
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0x04, "dead" -> true
// f(bytes): 0x20, 0x04, "dead" -> true
@@ -8,5 +8,7 @@ contract C {
correct = r == 0x7fff;
}
}
// ====
// compileViaYul: also
// ----
// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true
// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true
@@ -9,6 +9,8 @@ contract C {
}
receive() external payable {}
}
// ====
// compileViaYul: also
// ----
// (), 1 ether
// call() -> 1, 2, 2, 2
@@ -8,6 +8,8 @@ contract C {
return a;
}
}
// ====
// compileViaYul: also
// ----
// f() -> 4, 11, 0x0111, 0x333333, 2222222222222222222
// g() -> 0x10, 0x0100, 0x0101, 0x333333, 2222222222222222222
@@ -22,5 +22,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 2
@@ -22,5 +22,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 2
@@ -7,6 +7,8 @@ import "A";
contract B is A {
function f(uint256 x) public view returns(uint256) { return x; }
}
// ====
// compileViaYul: also
// ----
// f(uint256): 1337 -> 1337
// g(uint256): 1337 -> 1338
@@ -17,6 +17,8 @@ contract C {
return T(23, 42, "any");
}
}
// ====
// compileViaYul: also
// ----
// s() -> 23, 42
// t() -> 0x20, 23, 42, 0x60, 3, "any"
+1
View File
@@ -288,6 +288,7 @@ contract Test {
/// testMul() -> true
//
// ====
// compileViaYul: also
// EVMVersion: >=constantinople
// ----
// library: Pairing
@@ -41,5 +41,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> true
@@ -29,5 +29,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> 1
@@ -26,5 +26,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> 1
@@ -15,6 +15,8 @@ contract C {
return "\u0024\u00A2\u20AC";
}
}
// ====
// compileViaYul: also
// ----
// oneByteUTF8() -> 0x20, 7, "aaa$aaa"
// twoBytesUTF8() -> 0x20, 8, "aaa\xc2\xa2aaa"
@@ -3,5 +3,7 @@ contract C {
return "😃, 😭, and 😈";
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88"
@@ -13,5 +13,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256)): 42, 23 -> 42, 23
@@ -16,5 +16,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(uint256,(uint256,uint256),uint256): 1, 2, 3, 4 -> 1, 2, 3, 4
@@ -23,5 +23,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256),(uint256),(uint256,uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5
@@ -7,5 +7,7 @@ contract C {
return (s.children.length, s.a, s.children[0].b, s.children[1].b);
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,(uint256)[])): 32, 17, 64, 2, 23, 42 -> 2, 17, 23, 42
@@ -6,5 +6,7 @@ contract C {
return (s.a.length, s.a[0], s.a[1]);
}
}
// ====
// compileViaYul: also
// ----
// f((uint256[])): 32, 32, 2, 42, 23 -> 2, 42, 23
@@ -13,5 +13,7 @@ contract Test {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 3
@@ -5,5 +5,7 @@ contract c {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 1
@@ -6,5 +6,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 5, "b23a5"
@@ -58,6 +58,7 @@ contract C {
)
{}
}
// ====
// compileViaYul: false
// ----
// constructor() ->
@@ -1,13 +1,10 @@
pragma experimental SMTChecker;
contract C {
function f(bool b) public pure {
uint v = 0;
int[1] c;
function f(bool b) public {
if (b)
v |= 1;
assert(v == 1);
c[0] |= 1;
}
}
// ----
// Warning 9149: (106-112): Assertion checker does not yet implement this assignment operator.
// Warning 4661: (116-130): Assertion violation happens here
// Warning 9149: (97-106): Assertion checker does not yet implement this assignment operator.
@@ -0,0 +1,10 @@
pragma experimental SMTChecker;
contract C {
int[1][20] c;
function f(bool b) public {
if (b)
c[10][0] |= 1;
}
}
// ----
// Warning 9149: (101-114): Assertion checker does not yet implement this assignment operator.
@@ -0,0 +1,16 @@
pragma experimental SMTChecker;
contract C {
struct S {
uint x;
}
S s;
function f(bool b) public {
if (b)
s.x |= 1;
}
}
// ----
// Warning 8115: (71-74): Assertion checker does not yet support the type of this variable.
// Warning 7650: (117-120): Assertion checker does not yet support this expression.
// Warning 8364: (117-118): Assertion checker does not yet implement type struct C.S storage ref
// Warning 9149: (117-125): Assertion checker does not yet implement this assignment operator.
@@ -0,0 +1,17 @@
pragma experimental SMTChecker;
contract C {
struct S {
uint[] x;
}
S s;
function f(bool b) public {
if (b)
s.x[2] |= 1;
}
}
// ----
// Warning 8115: (73-76): Assertion checker does not yet support the type of this variable.
// Warning 7650: (119-122): Assertion checker does not yet support this expression.
// Warning 8364: (119-120): Assertion checker does not yet implement type struct C.S storage ref
// Warning 9118: (119-125): Assertion checker does not yet implement this expression.
// Warning 9149: (119-130): Assertion checker does not yet implement this assignment operator.
@@ -0,0 +1,2 @@
pragma experimental SMTChecker;
contract a { event b(uint[(1 / 1)]); }
@@ -0,0 +1,7 @@
contract C {
/// @inheritdoc X
function f() internal {
}
}
// ----
// DocstringParsingError 9397: (17-34): Documentation tag @inheritdoc references inexistent contract "X".
@@ -0,0 +1,10 @@
contract D {
}
contract C is D {
/// @inheritdoc D
function f() internal {
}
}
// ----
// DocstringParsingError 4682: (38-55): Documentation tag @inheritdoc references contract "D", but the contract does not contain a function that is overridden by this function.
@@ -0,0 +1,11 @@
contract D {
struct S { uint a; }
}
contract C is D {
/// @inheritdoc D.S
function f() internal {
}
}
// ----
// DocstringParsingError 1430: (63-82): Documentation tag @inheritdoc reference "D.S" is not a contract.
@@ -0,0 +1,8 @@
contract C {
struct S { uint a; }
/// @inheritdoc S
function f() internal {
}
}
// ----
// DocstringParsingError 1430: (42-59): Documentation tag @inheritdoc reference "S" is not a contract.
@@ -0,0 +1,17 @@
contract ERC20 {
/// @notice This event is emitted when a transfer occurs.
/// @param from The source account.
/// @param to The destination account.
/// @param amount The amount.
/// @dev A test case!
event Transfer(address indexed from, address indexed to, uint amount);
}
contract A is ERC20 {
/// @inheritdoc ERC20
event Transfer();
}
// ----
// DocstringParsingError 6546: (305-326): Documentation tag @inheritdoc not valid for events.
@@ -0,0 +1 @@
contract a { event b(uint[(1 / 1)]); }
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/util/BytesUtils.h>
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/util/ContractABIUtils.h>
+1
View File
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <test/libsolidity/util/TestFileParser.h>
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* Unit tests for Solidity's test expectation parser.
*/
@@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#include <functional>
#include <string>