mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -182,6 +182,30 @@ BOOST_AUTO_TEST_CASE(location_test)
|
||||
checkAssemblyLocations(items, locations);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(jump_type)
|
||||
{
|
||||
auto sourceCode = make_shared<CharStream>(R"(
|
||||
contract C {
|
||||
function f(uint a) public pure returns (uint t) {
|
||||
assembly {
|
||||
function g(x) -> y { if x { leave } y := 8 }
|
||||
t := g(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
)", "");
|
||||
AssemblyItems items = compileContract(sourceCode);
|
||||
|
||||
string jumpTypes;
|
||||
for (AssemblyItem const& item: items)
|
||||
if (item.getJumpType() != AssemblyItem::JumpType::Ordinary)
|
||||
jumpTypes += item.getJumpTypeAsString() + "\n";
|
||||
|
||||
BOOST_CHECK_EQUAL(jumpTypes, "[in]\n[out]\n[in]\n[out]\n");
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
} // end namespaces
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
function f(bytes memory a, bytes calldata b, uint[] memory c)
|
||||
external
|
||||
pure
|
||||
returns (uint, byte, uint, byte, uint, uint)
|
||||
{
|
||||
return (a.length, a[1], b.length, b[2], c.length, c[3]);
|
||||
}
|
||||
function g() public returns (uint, byte, uint, byte, uint, uint) {
|
||||
uint[] memory x = new uint[](4);
|
||||
x[3] = 7;
|
||||
return this.f("abc", "def", x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// g() -> 3, 0x6200000000000000000000000000000000000000000000000000000000000000, 3, 0x6600000000000000000000000000000000000000000000000000000000000000, 4, 7
|
||||
@@ -0,0 +1,20 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function f(bytes memory a, bytes calldata b, uint[] memory c)
|
||||
external
|
||||
pure
|
||||
returns (uint, byte, uint, byte, uint, uint)
|
||||
{
|
||||
return (a.length, a[1], b.length, b[2], c.length, c[3]);
|
||||
}
|
||||
function g() public returns (uint, byte, uint, byte, uint, uint) {
|
||||
uint[] memory x = new uint[](4);
|
||||
x[3] = 7;
|
||||
return this.f("abc", "def", x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// g() -> 3, 0x6200000000000000000000000000000000000000000000000000000000000000, 3, 0x6600000000000000000000000000000000000000000000000000000000000000, 4, 7
|
||||
@@ -16,7 +16,7 @@ contract B is A {
|
||||
function i(uint[] memory) public override payable {}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (300-353): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (358-419): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (424-485): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (490-546): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (300-353): Function with same name and parameter types defined twice.
|
||||
// DeclarationError 1686: (358-419): Function with same name and parameter types defined twice.
|
||||
// DeclarationError 1686: (424-485): Function with same name and parameter types defined twice.
|
||||
// DeclarationError 1686: (490-546): Function with same name and parameter types defined twice.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract A {
|
||||
function f(uint[] memory) internal pure {}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (17-61): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (17-61): Function with same name and parameter types defined twice.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract test {
|
||||
event A(uint i);
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 5883: (20-36): Event with same name and arguments defined twice.
|
||||
// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ contract test {
|
||||
event A(uint i) anonymous;
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 5883: (20-36): Event with same name and arguments defined twice.
|
||||
// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ contract test {
|
||||
event A(uint indexed i);
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 5883: (20-36): Event with same name and arguments defined twice.
|
||||
// DeclarationError 5883: (20-36): Event with same name and parameter types defined twice.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
function test(uint a) external {}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (17-66): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (17-66): Function with same name and parameter types defined twice.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract test {
|
||||
function fun(uint a) public returns(uint r) { return a; }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (189-246): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (189-246): Function with same name and parameter types defined twice.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract test {
|
||||
function fun() public { }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (20-45): Function with same name and arguments defined twice.
|
||||
// DeclarationError 1686: (20-45): Function with same name and parameter types defined twice.
|
||||
|
||||
Reference in New Issue
Block a user