mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into HEAD
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function foo() pure internal {
|
||||
address(10).staticcall{value: 7, gas: 3}("");
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
// TypeError 2842: (56-96): Cannot set option "value" for staticcall.
|
||||
// Warning 9302: (56-100): Return value of low-level calls not used.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
(bool success, ) = address(10).staticcall{gas: 3}("");
|
||||
success;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: <byzantium
|
||||
// ----
|
||||
// TypeError 5052: (66-100): "staticcall" is not supported by the VM version.
|
||||
@@ -0,0 +1,5 @@
|
||||
function fun() {}
|
||||
|
||||
contract C is fun {}
|
||||
// ----
|
||||
// TypeError 8758: (33-36): Contract expected.
|
||||
@@ -0,0 +1,11 @@
|
||||
function ff() {}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
assembly {
|
||||
let x := ff
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 2025: (90-92): Access to functions is not allowed in inline assembly.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
uint mload;
|
||||
assembly {
|
||||
let x := mload
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (118-119): Expected '(' but got '}'
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
uint mload;
|
||||
assembly {
|
||||
mload := 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (101-103): Expected '(' but got ':='
|
||||
@@ -11,6 +11,11 @@ contract C {
|
||||
ret := create2(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
function h() view external returns (bytes32 ret) {
|
||||
assembly {
|
||||
ret := extcodehash(address())
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
|
||||
@@ -11,6 +11,11 @@ contract C {
|
||||
ret := create2(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
function h() view external returns (bytes32 ret) {
|
||||
assembly {
|
||||
ret := extcodehash(address())
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: =byzantium
|
||||
@@ -23,3 +28,5 @@ contract C {
|
||||
// DeclarationError 8678: (160-178): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 6166: (283-290): The "create2" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (276-302): Variable count does not match number of values (1 vs. 0)
|
||||
// TypeError 7110: (412-423): The "extcodehash" instruction is only available for Constantinople-compatible VMs (you are currently compiling for "byzantium").
|
||||
// DeclarationError 8678: (405-434): Variable count does not match number of values (1 vs. 0)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
uint mload;
|
||||
}
|
||||
function g() public pure {
|
||||
uint mload;
|
||||
assembly {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 8261: (109-119): Variable is shadowed in inline assembly by an instruction of the same name
|
||||
// Warning 2072: (52-62): Unused local variable.
|
||||
// Warning 2072: (109-119): Unused local variable.
|
||||
@@ -0,0 +1,13 @@
|
||||
contract D {
|
||||
}
|
||||
contract C {
|
||||
function f() public {
|
||||
try new D() {
|
||||
} catch (bytes memory x) {
|
||||
x;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=byzantium
|
||||
// ----
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
function f() public returns (uint, uint) {
|
||||
try this {
|
||||
} catch {
|
||||
}
|
||||
try gasleft() {
|
||||
} catch {
|
||||
}
|
||||
try type(address) {
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5347: (72-76): Try can only be used with external function calls and contract creation calls.
|
||||
// TypeError 2536: (119-128): Try can only be used with external function calls and contract creation calls.
|
||||
// TypeError 4259: (176-183): Invalid type for argument in the function call. A contract type or an integer type is required, but type(address) provided.
|
||||
// TypeError 2536: (171-184): Try can only be used with external function calls and contract creation calls.
|
||||
@@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
function _() public pure {
|
||||
}
|
||||
|
||||
function g() public pure {
|
||||
_();
|
||||
}
|
||||
|
||||
function h() public pure {
|
||||
_;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
contract C {
|
||||
function f() public pure returns (uint) {
|
||||
uint _;
|
||||
return _;
|
||||
}
|
||||
|
||||
function g() public pure returns (uint) {
|
||||
uint _ = 1;
|
||||
return _;
|
||||
}
|
||||
|
||||
function h() public pure {
|
||||
_;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7576: (230-231): Undeclared identifier.
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
modifier m() {
|
||||
_;
|
||||
}
|
||||
|
||||
modifier n() {
|
||||
string memory _ = "";
|
||||
_;
|
||||
revert(_);
|
||||
}
|
||||
|
||||
function f() m() public {
|
||||
}
|
||||
|
||||
function g() n() public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user