mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10017 from ethereum/develop
Merge develop into breaking.
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
contract C {
|
||||
function exp_2(uint y) public returns (uint) {
|
||||
return 2**y;
|
||||
}
|
||||
function exp_minus_2(uint y) public returns (int) {
|
||||
return (-2)**y;
|
||||
}
|
||||
|
||||
function exp_uint_max(uint y) public returns (uint) {
|
||||
return (2**256 - 1)**y;
|
||||
}
|
||||
function exp_int_max(uint y) public returns (int) {
|
||||
return ((-2)**255)**y;
|
||||
}
|
||||
|
||||
function exp_5(uint y) public returns (uint) {
|
||||
return 5**y;
|
||||
}
|
||||
function exp_minus_5(uint y) public returns (int) {
|
||||
return (-5)**y;
|
||||
}
|
||||
|
||||
function exp_256(uint y) public returns (uint) {
|
||||
return 256**y;
|
||||
}
|
||||
function exp_minus_256(uint y) public returns (int) {
|
||||
return (-256)**y;
|
||||
}
|
||||
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// exp_2(uint256): 255 -> 57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_2(uint256): 256 -> FAILURE
|
||||
// exp_minus_2(uint256): 255 -> -57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_minus_2(uint256): 256 -> FAILURE
|
||||
// exp_uint_max(uint256): 1 -> 115792089237316195423570985008687907853269984665640564039457584007913129639935
|
||||
// exp_uint_max(uint256): 2 -> FAILURE
|
||||
// exp_int_max(uint256): 1 -> -57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_int_max(uint256): 2 -> FAILURE
|
||||
// exp_5(uint256): 110 -> 77037197775489434122239117703397092741524065928615527809597551822662353515625
|
||||
// exp_5(uint256): 111 -> FAILURE
|
||||
// exp_minus_5(uint256): 109 -> -15407439555097886824447823540679418548304813185723105561919510364532470703125
|
||||
// exp_minus_5(uint256): 110 -> FAILURE
|
||||
// exp_256(uint256): 31 -> 452312848583266388373324160190187140051835877600158453279131187530910662656
|
||||
// exp_256(uint256): 32 -> FAILURE
|
||||
// exp_minus_256(uint256): 31 -> -452312848583266388373324160190187140051835877600158453279131187530910662656
|
||||
// exp_minus_256(uint256): 32 -> FAILURE
|
||||
@@ -0,0 +1,41 @@
|
||||
contract C {
|
||||
function exp_2(uint y) public returns (uint) {
|
||||
return 2**y;
|
||||
}
|
||||
function exp_minus_2(uint y) public returns (int) {
|
||||
return (-2)**y;
|
||||
}
|
||||
|
||||
function exp_uint_max(uint y) public returns (uint) {
|
||||
return (2**256 - 1)**y;
|
||||
}
|
||||
function exp_int_max(uint y) public returns (int) {
|
||||
return ((-2)**255)**y;
|
||||
}
|
||||
|
||||
function exp_5(uint y) public returns (uint) {
|
||||
return 5**y;
|
||||
}
|
||||
function exp_minus_5(uint y) public returns (int) {
|
||||
return (-5)**y;
|
||||
}
|
||||
|
||||
function exp_256(uint y) public returns (uint) {
|
||||
return 256**y;
|
||||
}
|
||||
function exp_minus_256(uint y) public returns (int) {
|
||||
return (-256)**y;
|
||||
}
|
||||
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// exp_2(uint256): 255 -> 57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_minus_2(uint256): 255 -> -57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_uint_max(uint256): 1 -> 115792089237316195423570985008687907853269984665640564039457584007913129639935
|
||||
// exp_int_max(uint256): 1 -> -57896044618658097711785492504343953926634992332820282019728792003956564819968
|
||||
// exp_5(uint256): 110 -> 77037197775489434122239117703397092741524065928615527809597551822662353515625
|
||||
// exp_minus_5(uint256): 109 -> -15407439555097886824447823540679418548304813185723105561919510364532470703125
|
||||
// exp_256(uint256): 31 -> 452312848583266388373324160190187140051835877600158453279131187530910662656
|
||||
// exp_minus_256(uint256): 31 -> -452312848583266388373324160190187140051835877600158453279131187530910662656
|
||||
@@ -4,8 +4,9 @@ contract C
|
||||
{
|
||||
function f() public pure {
|
||||
uint[3] memory array = [uint(1), 2, 3];
|
||||
assert(array[0] == 1);
|
||||
assert(array[1] == 2);
|
||||
assert(array[2] == 3);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2072: (76-96): Unused local variable.
|
||||
// Warning 2177: (99-114): Assertion checker does not yet implement inline arrays.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f() public pure {
|
||||
uint[3] memory a = [uint(1), 2, 3];
|
||||
uint[3] memory b = [uint(1), 2, 4];
|
||||
assert(a[0] == b[0]);
|
||||
assert(a[1] == b[1]);
|
||||
assert(a[2] == b[2]); // fails
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (200-220): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f() public pure {
|
||||
(uint[3] memory a, uint[3] memory b) = ([uint(1), 2, 3], [uint(1), 2, 4]);
|
||||
assert(a[0] == b[0]);
|
||||
assert(a[1] == b[1]);
|
||||
assert(a[2] == b[2]); // fails
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (201-221): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f(bool c) public pure {
|
||||
uint[3] memory a = c ? [uint(1), 2, 3] : [uint(1), 2, 4];
|
||||
uint[3] memory b = [uint(1), 2, c ? 3 : 4];
|
||||
assert(a[0] == b[0]);
|
||||
assert(a[1] == b[1]);
|
||||
assert(a[2] == b[2]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,16 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[] s;
|
||||
function f() public {
|
||||
uint[3] memory a = [uint(1), 2, 3];
|
||||
s = a;
|
||||
assert(s.length == a.length);
|
||||
assert(s[0] == a[0]);
|
||||
assert(s[1] == a[1]);
|
||||
assert(s[2] != a[2]); // fails
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (209-229): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,18 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
function f() public pure {
|
||||
uint[3] memory a = [uint(1), 2, 3];
|
||||
uint[4] memory b = [uint(1), 2, 4, 3];
|
||||
uint[4] memory c = b;
|
||||
assert(a.length == c.length); // fails
|
||||
assert(a[0] == c[0]);
|
||||
assert(a[1] == c[1]);
|
||||
assert(a[2] == c[2]); // fails
|
||||
assert(a[2] == c[3]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (179-207): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (268-288): CHC: Assertion violation happens here.
|
||||
@@ -0,0 +1,23 @@
|
||||
pragma experimental SMTChecker;
|
||||
|
||||
contract C
|
||||
{
|
||||
uint[] s;
|
||||
function f() public {
|
||||
uint[3] memory a = [uint(1), 2, 3];
|
||||
uint[4] memory b = [uint(1), 2, 4, 3];
|
||||
uint[4] memory c = b;
|
||||
assert(c.length == b.length);
|
||||
s = a;
|
||||
assert(s.length == a.length);
|
||||
|
||||
assert(s.length == c.length); // fails
|
||||
assert(s[0] == c[0]);
|
||||
assert(s[1] == c[1]);
|
||||
assert(s[2] == c[2]); // fails
|
||||
assert(s[2] == c[3]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (259-287): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (348-368): CHC: Assertion violation happens here.
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
==== Source: A ====
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
struct Item {
|
||||
uint x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
event Ev(Item);
|
||||
}
|
||||
==== Source: B ====
|
||||
import "A";
|
||||
|
||||
contract D is C {}
|
||||
// ----
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
==== Source: A ====
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct Item {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function get(Item memory) external view {}
|
||||
}
|
||||
==== Source: B ====
|
||||
import "A";
|
||||
|
||||
contract D is C {}
|
||||
// ----
|
||||
// TypeError 6594: (B:13-31): Contract "D" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature.
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
==== Source: A ====
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct Item {
|
||||
uint x;
|
||||
}
|
||||
|
||||
function get() external view returns(Item memory) {}
|
||||
}
|
||||
==== Source: B ====
|
||||
import "A";
|
||||
|
||||
contract D is C {}
|
||||
// ----
|
||||
// TypeError 6594: (B:13-31): Contract "D" does not use ABIEncoderV2 but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature.
|
||||
Reference in New Issue
Block a user