Tests, Docs and Changelog

This commit is contained in:
hrkrshnn
2020-04-28 16:03:52 +05:30
parent 051eec5c51
commit bd0b06e8db
29 changed files with 51 additions and 110 deletions
@@ -4,7 +4,6 @@ contract C {
this.foo{value:2, gas: 5}{gas:2};
(this.foo{value:2, gas: 5}){gas:2};
this.foo{value:2, gas: 5}{value:6};
this.foo.value(4){value:2, gas: 5};
this.foo{gas:2, value: 5}{value:2, gas:5};
new D{salt:"abc"}{salt:"a"}();
}
@@ -15,8 +14,6 @@ contract C {
// TypeError: (78-110): Option "gas" has already been set.
// TypeError: (120-154): Option "gas" has already been set.
// TypeError: (164-198): Option "value" has already been set.
// Warning: (208-222): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// TypeError: (208-242): Option "value" has already been set.
// TypeError: (252-293): Option "value" has already been set.
// TypeError: (252-293): Option "gas" has already been set.
// TypeError: (303-330): Option "salt" has already been set.
// TypeError: (208-249): Option "value" has already been set.
// TypeError: (208-249): Option "gas" has already been set.
// TypeError: (259-286): Option "salt" has already been set.
@@ -1,8 +1,8 @@
contract C {
function (uint) external returns (uint) x;
function f() public {
x.value(2)(1);
x{value: 2}(1);
}
}
// ----
// TypeError: (94-101): Member "value" is only available for payable functions.
// TypeError: (94-105): Cannot set option "value" on a non-payable function type.
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
// Warning: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// TypeError: (102-107): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
@@ -8,4 +8,4 @@ contract D {
}
}
// ----
// Warning: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// TypeError: (122-135): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
@@ -5,4 +5,4 @@ contract C {
}
}
// ----
// Warning: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// TypeError: (102-109): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
@@ -1,10 +1,7 @@
contract test {
function f() public {
address(0x12).call.value(2)("abc");
address(0x12).call{value: 2}("abc");
}
}
// ----
// Warning: (50-74): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (50-84): Return value of low-level calls not used.
// Warning: (94-129): Return value of low-level calls not used.
// Warning: (50-85): Return value of low-level calls not used.
@@ -1,11 +1,7 @@
contract receiver { function pay() payable public {} }
contract test {
function f() public { (new receiver()).pay{value: 10}(); }
function g() public { (new receiver()).pay.value(10)(); }
receiver r = new receiver();
function h() public { r.pay{value: 10}(); }
function i() public { r.pay.value(10)(); }
}
// ----
// Warning: (160-186): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (303-314): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
@@ -3,9 +3,9 @@ contract C {
}
contract D {
function f() public returns (uint) {
(new C).value(2)();
(new C){value: 2}();
return 2;
}
}
// ----
// TypeError: (106-119): Constructor for contract C must be payable for member "value" to be available.
// TypeError: (106-123): Cannot set option "value", since the constructor of contract C is not payable.
@@ -1,26 +1,14 @@
contract C {
function f() external payable {}
function g(address a) external pure {
a.call.value(42);
a.call{value: 42};
a.call.gas(42);
a.call{gas: 42};
a.staticcall.gas(42);
a.staticcall{gas: 42};
a.delegatecall.gas(42);
a.delegatecall{gas: 42};
}
function h() external view {
this.f.value(42);
this.f{value: 42};
this.f.gas(42);
this.f{gas: 42};
}
}
// ----
// Warning: (91-103): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (132-142): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (169-185): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (218-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (304-316): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (345-355): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
@@ -1,27 +1,12 @@
contract C {
function f(address a) external view returns (bool success) {
(success,) = a.call.gas(42)("");
(success,) = a.call{gas: 42}("");
}
function g(address a) external view returns (bool success) {
(success,) = a.call.gas(42)("");
(success,) = a.call{gas: 42}("");
}
function h() external payable {}
function i() external view {
this.h.gas(42)();
}
function j() external view {
this.h{gas: 42}();
}
}
// ----
// Warning: (90-100): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (226-236): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (351-361): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// TypeError: (90-108): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (125-144): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (226-244): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (261-280): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (351-367): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (404-421): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (90-109): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (180-197): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
@@ -2,14 +2,10 @@ contract C {
function f() external view {}
function test(address a) external view returns (bool status) {
// This used to incorrectly raise an error about violating the view mutability.
(status,) = a.staticcall.gas(42)("");
(status,) = a.staticcall{gas: 42}("");
this.f.gas(42)();
this.f{gas: 42}();
}
}
// ====
// EVMVersion: >=byzantium
// ----
// Warning: (207-223): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
// Warning: (276-286): Using ".gas(...)" is deprecated. Use "{gas: ...}" instead.
@@ -1,25 +1,12 @@
contract C {
function f(address a) external view returns (bool success) {
(success,) = a.call.value(42)("");
(success,) = a.call{value: 42}("");
}
function g(address a) external view returns (bool success) {
(success,) = a.call.value(42)("");
(success,) = a.call{value: 42}("");
}
function h() external payable {}
function i() external view {
this.h.value(42)();
this.h{value: 42}();
}
}
// ----
// Warning: (90-102): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (230-242): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// Warning: (359-371): Using ".value(...)" is deprecated. Use "{value: ...}" instead.
// TypeError: (90-110): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (127-148): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (230-250): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (267-288): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (359-377): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (381-400): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (90-111): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (182-201): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.