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:
@@ -0,0 +1,23 @@
|
||||
contract A1 { constructor() public {} }
|
||||
contract B1 is A1 {}
|
||||
|
||||
contract A2 { constructor() public payable {} }
|
||||
contract B2 is A2 {}
|
||||
|
||||
contract B3 {}
|
||||
|
||||
contract B4 { constructor() public {} }
|
||||
|
||||
contract C {
|
||||
function f() public payable {
|
||||
new B1{value: 10}();
|
||||
new B2{value: 10}();
|
||||
new B3{value: 10}();
|
||||
new B4{value: 10}();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (235-252): Cannot set option "value", since the constructor of contract B1 is not payable.
|
||||
// TypeError: (258-275): Cannot set option "value", since the constructor of contract B2 is not payable.
|
||||
// TypeError: (281-298): Cannot set option "value", since the constructor of contract B3 is not payable.
|
||||
// TypeError: (304-321): Cannot set option "value", since the constructor of contract B4 is not payable.
|
||||
@@ -0,0 +1,16 @@
|
||||
contract A1 {}
|
||||
contract B1 is A1 { constructor() public payable {} }
|
||||
|
||||
contract A2 { constructor() public {} }
|
||||
contract B2 is A2 { constructor() public payable {} }
|
||||
|
||||
contract B3 { constructor() public payable {} }
|
||||
|
||||
contract C {
|
||||
function f() public payable {
|
||||
new B1{value: 10}();
|
||||
new B2{value: 10}();
|
||||
new B3{value: 10}();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public payable {
|
||||
function() external payable x = this.f{value: 7};
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-94): Type function () payable external is not implicitly convertible to expected type function () payable external.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract A {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(A).creationCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
contract A {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(A).runtimeCode;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (153-172): "runtimeCode" is not available for contracts containing immutable variables.
|
||||
@@ -0,0 +1,13 @@
|
||||
contract Base {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Derived is Base {}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(Derived).runtimeCode;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (185-210): "runtimeCode" is not available for contracts containing immutable variables.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract Min {
|
||||
function contractMin() public {
|
||||
type(Min).min;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (50-63): Member "min" not found or not visible after argument-dependent lookup in type(contract Min).
|
||||
@@ -0,0 +1,7 @@
|
||||
contract test {
|
||||
function intName() public {
|
||||
type(int).name;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-61): Member "name" not found or not visible after argument-dependent lookup in type(int256).
|
||||
@@ -0,0 +1,12 @@
|
||||
contract Test {
|
||||
function basic() public pure {
|
||||
uint uintMax = type(uint).max;
|
||||
uintMax;
|
||||
int intMax = type(int).max;
|
||||
intMax;
|
||||
uint uintMin = type(uint).min;
|
||||
uintMin;
|
||||
int intMin = type(int).min;
|
||||
intMin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
contract Test {
|
||||
function assignment() public {
|
||||
uint8 uint8Min = type(int).min;
|
||||
uint uintMin = type(int).min;
|
||||
|
||||
if (type(int).min == 2**256 - 1) {
|
||||
uintMin;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (59-89): Type int256 is not implicitly convertible to expected type uint8.
|
||||
// TypeError: (99-127): Type int256 is not implicitly convertible to expected type uint256.
|
||||
// TypeError: (142-169): Operator == not compatible with types int256 and int_const 1157...(70 digits omitted)...9935
|
||||
@@ -0,0 +1,16 @@
|
||||
contract test {
|
||||
|
||||
function viewAssignment() public view {
|
||||
int min = type(int).min;
|
||||
min;
|
||||
}
|
||||
|
||||
function assignment() public {
|
||||
int max = type(int).max;
|
||||
max;
|
||||
}
|
||||
|
||||
}
|
||||
// ----
|
||||
// Warning: (21-112): Function state mutability can be restricted to pure
|
||||
// Warning: (118-200): Function state mutability can be restricted to pure
|
||||
@@ -4,5 +4,5 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (65-75): Invalid type for argument in function call. Contract type required, but type(contract Test) provided.
|
||||
// TypeError: (60-76): Invalid type for argument in function call. Contract type required, but tuple() provided.
|
||||
// TypeError: (65-75): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract Test) provided.
|
||||
// TypeError: (60-76): Invalid type for argument in the function call. A contract type or an integer type is required, but tuple() provided.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (154-155): Invalid type for argument in function call. Contract type required, but type(struct Test.S) provided.
|
||||
// TypeError: (154-155): Invalid type for argument in the function call. A contract type or an integer type is required, but type(struct Test.S) provided.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
pragma solidity ^0.6.0;
|
||||
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract Ownable {
|
||||
address private _owner;
|
||||
|
||||
modifier onlyOwner() {
|
||||
require(msg.sender == _owner, "Ownable: caller is not the owner");
|
||||
_;
|
||||
}
|
||||
|
||||
function renounceOwnership() public onlyOwner { }
|
||||
}
|
||||
|
||||
library VoteTiming {
|
||||
function init(uint phaseLength) internal pure {
|
||||
require(true, "");
|
||||
}
|
||||
}
|
||||
|
||||
contract Voting is Ownable {
|
||||
constructor() public {
|
||||
VoteTiming.init(1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (324-340): Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
Reference in New Issue
Block a user