Look for experimental pragmas in the module containing the definition when generating code for modifiers and inherited functions

This commit is contained in:
Kamil Śliwak
2020-10-12 14:29:53 +02:00
parent e7603d7590
commit 3128e82a9a
11 changed files with 264 additions and 0 deletions
@@ -0,0 +1,27 @@
==== Source: A ====
pragma experimental ABIEncoderV2;
struct Data {
bool flag;
}
contract A {
function get() public view returns (Data memory) {}
}
contract B {
modifier validate() {
A(0x00).get();
_;
}
}
==== Source: B ====
import "A";
contract C is B {
function foo()
public
validate()
{}
}
// ----
@@ -0,0 +1,33 @@
==== Source: A ====
pragma experimental ABIEncoderV2;
struct Data {
bool flag;
}
contract A {
function get() public view returns (Data memory) {}
}
contract B {
constructor() validate {
A(0x00).get();
}
modifier validate() {
A(0x00).get();
_;
}
}
==== Source: B ====
import "A";
contract C is B {}
==== Source: C ====
import "B";
contract D is C {
constructor() validate B() validate C() validate {}
}
// ----
@@ -0,0 +1,25 @@
==== Source: A ====
pragma experimental ABIEncoderV2;
struct Data {
bool flag;
}
contract A {
function get() public view returns (Data memory) {}
}
contract B {
constructor() {
A(0x00).get();
}
function foo() public view {
A(0x00).get();
}
}
==== Source: B ====
import "A";
contract C is B {}
// ----
@@ -0,0 +1,21 @@
==== Source: A ====
pragma experimental ABIEncoderV2;
struct Item {
uint x;
}
library L {
event Ev(Item);
}
contract C {
function foo() public {
emit L.Ev(Item(1));
}
}
==== Source: B ====
import "A";
contract D is C {}
// ----
@@ -0,0 +1,29 @@
==== Source: A ====
pragma experimental ABIEncoderV2;
struct Data {
bool flag;
}
contract A {
function get() public view returns (Data memory) {}
}
contract B {
modifier validate() virtual {
A(0x00).get();
_;
}
}
==== Source: B ====
import "A";
contract C is B {
function foo() public pure validate {}
modifier validate() override {
_;
}
}
// ----
@@ -0,0 +1,52 @@
==== Source: C ====
import "X";
import "V1A";
import "V2A";
import "V1B";
contract C is V1A, V2A, V1B {
function foo()
public
modV1A
modV2A // There should be no error for modV2A (it uses ABIEncoderV2)
modV1B
{
}
}
==== Source: V1A ====
import "X";
contract V1A {
modifier modV1A() {
_;
}
}
==== Source: V1B ====
import "X";
contract V1B {
modifier modV1B() {
_;
}
}
==== Source: V2A ====
pragma experimental ABIEncoderV2;
import "X";
contract V2A {
modifier modV2A() {
X(0x00).get();
_;
}
}
==== Source: X ====
pragma experimental ABIEncoderV2;
struct Data {
bool flag;
}
contract X {
function get() public view returns (Data memory) {}
}
// ----