Test updates after disallowing Integer -> Contract conversion

This commit is contained in:
hrkrshnn
2020-12-03 17:53:00 +01:00
parent 40244c5469
commit 9e5d7b9910
39 changed files with 85 additions and 87 deletions
@@ -13,8 +13,8 @@ import "A";
contract Test {
function foo() public view {
C(0x00).set({_item: C.Item(50), _z: false, _y: "abc", _x: 30});
C(address(0x00)).set({_item: C.Item(50), _z: false, _y: "abc", _x: 30});
}
}
// ----
// TypeError 2443: (B:90-100): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2443: (B:99-109): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -9,8 +9,8 @@ import "A";
contract D {
function g() public view {
C(0x00).f();
C(address(0x00)).f();
}
}
// ----
// TypeError 2428: (B:65-76): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:65-85): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -13,8 +13,8 @@ import "A";
contract Test {
function foo() public view {
C(0x00).get();
C(address(0x00)).get();
}
}
// ----
// TypeError 2428: (B:70-83): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -13,8 +13,8 @@ import "A";
contract Test {
function foo() public view {
C(0x00).get();
C(address(0x00)).get();
}
}
// ----
// TypeError 2428: (B:70-83): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -11,7 +11,7 @@ contract A {
contract B {
modifier validate() {
A(0x00).get();
A(address(0x00)).get();
_;
}
}
@@ -11,11 +11,11 @@ contract A {
contract B {
constructor() validate {
A(0x00).get();
A(address(0x00)).get();
}
modifier validate() {
A(0x00).get();
A(address(0x00)).get();
_;
}
}
@@ -11,11 +11,11 @@ contract A {
contract B {
constructor() {
A(0x00).get();
A(address(0x00)).get();
}
function foo() public view {
A(0x00).get();
A(address(0x00)).get();
}
}
==== Source: B ====
@@ -11,7 +11,7 @@ contract A {
contract B {
modifier validate() virtual {
A(0x00).get();
A(address(0x00)).get();
_;
}
}
@@ -35,7 +35,7 @@ import "X";
contract V2A {
modifier modV2A() {
X(0x00).get();
X(address(0x00)).get();
_;
}
}
@@ -11,7 +11,7 @@ import "A";
contract D {
function g() public view {
C(0x00).f();
C(address(0x00)).f();
}
}
// ----
@@ -15,7 +15,7 @@ import "A";
contract Test {
function foo() public view {
C(0x00).get();
C(address(0x00)).get();
}
}
// ----
@@ -15,7 +15,7 @@ import "A";
contract Test {
function foo() public view {
C(0x00).get();
C(address(0x00)).get();
}
}
// ----
@@ -13,7 +13,7 @@ import "A";
contract B {
modifier validate() {
A(0x00).get();
A(address(0x00)).get();
_;
}
}
@@ -27,4 +27,4 @@ contract C is B {
{}
}
// ----
// TypeError 2428: (B:60-73): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -13,7 +13,7 @@ import "A";
contract B {
modifier validate() {
A(0x00).get();
A(address(0x00)).get();
_;
}
}
@@ -29,4 +29,4 @@ contract C is B {
{}
}
// ----
// TypeError 2428: (B:60-73): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
@@ -2,12 +2,12 @@
contract A { constructor(string memory) { } }
contract B is A {
function f() pure public {
A x = A(0); // convert from address
A x = A(address(0)); // convert from address
string memory y = "ab";
A(y); // call as a function is invalid
x;
}
}
// ----
// TypeError 3656: (124-294): Contract "B" should be marked as abstract.
// TypeError 9640: (243-247): Explicit type conversion not allowed from "string memory" to "contract A".
// TypeError 3656: (124-303): Contract "B" should be marked as abstract.
// TypeError 9640: (252-256): Explicit type conversion not allowed from "string memory" to "contract A".
@@ -1,4 +1,4 @@
==== Source: a ====
contract A {}
==== Source: dir/a/b/c ====
import "../../.././a" as x; contract B is x.A { fallback() external { x.A r = x.A(20); r; } }
import "../../.././a" as x; contract B is x.A { fallback() external { x.A r = x.A(address(20)); r; } }
@@ -1,12 +1,12 @@
contract First {
function fun() public returns (bool) {
return Second(1).fun(1, true, 3) > 0;
return Second(address(1)).fun(1, true, 3) > 0;
}
}
contract Second {
function fun(uint, bool, uint) public returns (uint) {
if (First(2).fun() == true) return 1;
if (First(address(2)).fun() == true) return 1;
}
}
// ----
// Warning 6321: (183-187): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
// Warning 6321: (192-196): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
@@ -1,4 +1,4 @@
contract A { function f() public virtual { uint8 x = C(0).g(); } }
contract A { function f() public virtual { uint8 x = C(address(0)).g(); } }
contract B { function f() public virtual {} function g() public returns (uint8) {} }
contract C is A, B { function f() public override (A, B) { A.f(); } }
// ----
@@ -1,7 +1,7 @@
contract A { }
contract B is A {
function f() public { A a = B(1); }
function f() public { A a = B(address(1)); }
}
// ----
// Warning 2072: (59-62): Unused local variable.
// Warning 2018: (37-72): Function state mutability can be restricted to pure
// Warning 2018: (37-81): Function state mutability can be restricted to pure
@@ -1,6 +1,6 @@
contract A { }
contract B is A {
function f() public { B b = A(1); }
function f() public { B b = A(address(1)); }
}
// ----
// TypeError 9574: (59-69): Type contract A is not implicitly convertible to expected type contract B.
// TypeError 9574: (59-78): Type contract A is not implicitly convertible to expected type contract B.
@@ -2,6 +2,6 @@ contract c {
function f() public {}
}
contract d {
function g() public { c(0).f(); }
function g() public { c(address(0)).f(); }
}
// ----
@@ -2,7 +2,7 @@ contract c {
function f() internal {}
}
contract d {
function g() public { c(0).f(); }
function g() public { c(address(0)).f(); }
}
// ----
// TypeError 9582: (83-89): Member "f" not found or not visible after argument-dependent lookup in contract c.
// TypeError 9582: (83-98): Member "f" not found or not visible after argument-dependent lookup in contract c.
@@ -2,7 +2,7 @@ contract c {
uint a;
}
contract d {
function g() public { c(0).a(); }
function g() public { c(address(0)).a(); }
}
// ----
// TypeError 9582: (66-72): Member "a" not found or not visible after argument-dependent lookup in contract c.
// TypeError 9582: (66-81): Member "a" not found or not visible after argument-dependent lookup in contract c.
@@ -2,7 +2,7 @@ contract c {
uint public a;
}
contract d {
function g() public { c(0).a(); }
function g() public { c(address(0)).a(); }
}
// ----
// Warning 2018: (51-84): Function state mutability can be restricted to view
// Warning 2018: (51-93): Function state mutability can be restricted to view
@@ -1,3 +1,3 @@
contract C {
C constant x = C(0x123);
C constant x = C(address(0x123));
}
@@ -256,7 +256,7 @@ contract Main {
A constant JU = JV;
A constant JV = JW;
A constant JW = JX;
A constant JX = A(0x00);
A constant JX = A(address(0x00));
}
// ----
// DeclarationError 7380: (6105-6123): Variable definition exhausting cyclic dependency validator.
@@ -131,5 +131,5 @@ contract Main {
A constant EZ = FA;
A constant FA = FB;
A constant FB = FC;
A constant FC = A(0x00);
A constant FC = A(address(0x00));
}
@@ -4,39 +4,39 @@ contract C
function f() public pure {
uint16 a = uint16(uint8(int8(-1)));
a;
a;
int8 b = -1;
b;
b;
uint16 c = uint16(uint8(b));
c;
c;
int8 d = int8(int16(uint16(type(uint16).max)));
d;
d;
uint16 e = type(uint16).max;
e;
e;
int8 g = int8(uint8(e));
g;
g;
address h = address(uint160(uint(type(uint).max)));
h;
h;
uint i = uint(uint160(address(0)));
i;
i;
uint j = type(uint).max;
j;
j;
address k = address(uint160(j));
k;
k;
int80 l = int80(uint80(bytes10("h")));
l;
l;
bytes10 m = bytes10(uint80(int80(-1)));
m;
m;
B n = B(uint(int(100)));
n;
B n = B(address(uint160(uint(int(100)))));
n;
}
}
// ----
@@ -3,7 +3,7 @@ contract C {
return this;
}
function g() pure public returns (bytes4) {
C x = C(0x123);
C x = C(address(0x123));
return x.f.selector;
}
}