mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added a multisource test for UserDefinedValueTypes and imports
Testing if `import {MyType} from "source";` works
This commit is contained in:
parent
48e16ceb88
commit
15fb427a99
@ -0,0 +1,14 @@
|
||||
==== Source: A ====
|
||||
type MyInt is int;
|
||||
type MyAddress is address;
|
||||
==== Source: B ====
|
||||
import {MyInt, MyAddress as OurAddress} from "A";
|
||||
contract A {
|
||||
function f(int x) external view returns(MyInt) { return MyInt.wrap(x); }
|
||||
function f(address x) external view returns(OurAddress) { return OurAddress.wrap(x); }
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256): 5 -> 5
|
||||
// f(address): 1 -> 1
|
@ -0,0 +1,13 @@
|
||||
==== Source: s1.sol ====
|
||||
type MyInt is int;
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol" as M;
|
||||
contract C {
|
||||
function f(int x) public pure returns (M.MyInt) { return M.MyInt.wrap(x); }
|
||||
function g(M.MyInt x) public pure returns (int) { return M.MyInt.unwrap(x); }
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(int256): 5 -> 5
|
||||
// g(int256): 1 -> 1
|
@ -0,0 +1,10 @@
|
||||
==== Source: A ====
|
||||
type MyInt is int;
|
||||
type MyAddress is address;
|
||||
==== Source: B ====
|
||||
import {MyAddress as OurAddress} from "A";
|
||||
contract A {
|
||||
function f(int x) external view returns(MyInt) { return MyInt.wrap(x); }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (B:100-105): Identifier not found or not unique.
|
@ -0,0 +1,10 @@
|
||||
==== Source: A ====
|
||||
type MyInt is int;
|
||||
type MyAddress is address;
|
||||
==== Source: B ====
|
||||
import {MyAddress as OurAddress} from "A";
|
||||
contract A {
|
||||
function f(address x) external view returns(MyAddress) { return MyAddress.wrap(x); }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (B:104-113): Identifier not found or not unique.
|
@ -0,0 +1,9 @@
|
||||
==== Source: s1.sol ====
|
||||
type MyInt is int;
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol" as M;
|
||||
contract C {
|
||||
function f(int x) public pure returns (M.MyInt) { return M.MyInt.wrap(x); }
|
||||
function g(M.MyInt x) public pure returns (int) { return M.MyInt.unwrap(x); }
|
||||
}
|
||||
// ----
|
@ -0,0 +1,9 @@
|
||||
==== Source: s1.sol ====
|
||||
type MyInt is int;
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol" as M;
|
||||
contract C {
|
||||
function f(int x) public pure returns (MyInt) { return MyInt.wrap(x); }
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 7920: (s2.sol:76-81): Identifier not found or not unique.
|
Loading…
Reference in New Issue
Block a user