Extract some import tests.

This commit is contained in:
Daniel Kirchner
2019-08-19 14:45:26 +02:00
committed by chriseth
parent 6ed219ebe8
commit aa2167b208
25 changed files with 183 additions and 427 deletions
@@ -0,0 +1,4 @@
==== Source: a ====
import "b"; contract C { D d; }
==== Source: b ====
import "a"; contract D { C c; }
@@ -0,0 +1,5 @@
==== Source: a ====
contract A {} contract B {} contract C { struct S { uint a; } }
==== Source: b ====
import "a" as x; import {B as b, C as c, C} from "a";
contract D is b { function f(c.S memory var1, x.C.S memory var2, C.S memory var3) internal {} }
@@ -0,0 +1,6 @@
==== Source: a/.b.sol ====
contract B {}
==== Source: a/a.sol ====
import ".b.sol"; contract A is B {}
// ----
// ParserError: (a/a.sol:0-16): Source ".b.sol" not found: File not supplied initially.
@@ -0,0 +1,6 @@
==== Source: a ====
contract C { D d; }
==== Source: b ====
import "a"; contract D is C {}
// ----
// DeclarationError: (a:13-14): Identifier not found or not unique.
@@ -0,0 +1,7 @@
==== Source: a ====
contract C { }
==== Source: b ====
import "a";
==== Source: c ====
import "b";
contract D is C {}
@@ -0,0 +1,23 @@
==== Source: A.sol ====
pragma experimental ABIEncoderV2;
contract A
{
struct S { uint a; }
S public s;
function f(S memory _s) public returns (S memory,S memory) { }
}
==== Source: B.sol ====
pragma experimental ABIEncoderV2;
import "./A.sol";
contract B is A { }
==== Source: C.sol ====
pragma experimental ABIEncoderV2;
import "./B.sol";
contract C is B { }
// ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (B.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (C.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,21 @@
==== Source: A.sol ====
pragma experimental ABIEncoderV2;
contract A
{
struct S { uint a; }
S public s;
function f(S memory _s) public returns (S memory,S memory) { }
}
==== Source: B.sol ====
pragma experimental ABIEncoderV2;
import "./A.sol";
contract B is A { }
==== Source: C.sol ====
import "./B.sol";
contract C is B { }
// ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (B.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (C.sol:18-37): Contract "C" does not use the new experimental ABI encoder 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.
@@ -0,0 +1,18 @@
==== Source: A.sol ====
pragma experimental ABIEncoderV2;
contract A
{
struct S { uint a; }
S public s;
function f(S memory _s) public returns (S memory,S memory) { }
}
==== Source: B.sol ====
import "./A.sol";
contract B is A { }
==== Source: C.sol ====
import "./B.sol";
contract C is B { }
// ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (B.sol:18-37): Contract "B" does not use the new experimental ABI encoder 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.
@@ -0,0 +1,8 @@
==== Source: a ====
library A {}
==== Source: b ====
library A {}
==== Source: c ====
import {A} from "./a"; import {A} from "./b";
// ----
// DeclarationError: (c:23-45): Identifier already declared.
@@ -0,0 +1,4 @@
==== Source: a ====
contract A {}
==== Source: b ====
library A {}
@@ -0,0 +1,6 @@
==== Source: a ====
contract A {}
==== Source: b ====
import "a"; contract A {}
// ----
// DeclarationError: (b:12-25): Identifier already declared.
@@ -0,0 +1,6 @@
==== Source: a ====
contract A {}
==== Source: b ====
import "a" as A; contract A {}
// ----
// DeclarationError: (b:17-30): Identifier already declared.
@@ -0,0 +1,6 @@
==== Source: a ====
contract A {}
==== Source: b ====
import {A as b} from "a"; contract b {}
// ----
// DeclarationError: (b:26-39): Identifier already declared.
@@ -0,0 +1,6 @@
==== Source: a ====
contract A {}
==== Source: b ====
import {A} from "a"; contract A {}
// ----
// DeclarationError: (b:21-34): Identifier already declared.
@@ -0,0 +1,4 @@
==== Source: a ====
contract A {}
==== Source: b ====
import {A} from "a"; contract B {}
@@ -0,0 +1,4 @@
==== Source: a ====
contract C {}
==== Source: b ====
import "a"; contract D is C {}
@@ -0,0 +1,6 @@
==== Source: a ====
import "./dir/b"; contract A is B {}
==== Source: dir/b ====
contract B {}
==== Source: dir/c ====
import "../a"; contract C is A {}
@@ -0,0 +1,4 @@
==== Source: a ====
contract A {}
==== Source: dir/a/b/c ====
import "../../.././a"; contract B is A {}
@@ -0,0 +1,6 @@
==== Source: B.sol ====
contract C {}
==== Source: b ====
import {C as msg} from "B.sol";
// ----
// Warning: (B.sol:0-13): This declaration shadows a builtin symbol.
@@ -0,0 +1,8 @@
==== Source: B.sol ====
contract X {}
==== Source: b ====
import * as msg from "B.sol";
contract C {
}
// ----
// Warning: (b:0-29): This declaration shadows a builtin symbol.
@@ -0,0 +1,11 @@
==== Source: B.sol ====
contract msg {} contract block{}
==== Source: b ====
import {msg, block} from "B.sol";
contract C {
}
// ----
// Warning: (B.sol:0-15): This declaration shadows a builtin symbol.
// Warning: (B.sol:16-32): This declaration shadows a builtin symbol.
// Warning: (B.sol:0-15): This declaration shadows a builtin symbol.
// Warning: (B.sol:16-32): This declaration shadows a builtin symbol.
@@ -0,0 +1,8 @@
==== Source: a ====
library A {}
==== Source: b ====
library A {}
==== Source: c ====
import {A} from "./a"; import {A} from "./b";
// ----
// DeclarationError: (c:23-45): Identifier already declared.
@@ -0,0 +1,4 @@
==== Source: a ====
contract A {}
==== Source: dir/a/b/c ====
import "../../.././a" as x; contract B is x.A { function() external { x.A r = x.A(20); r; } }
@@ -0,0 +1,2 @@
==== Source: a ====
contract C {}