mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Bound functions.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Error (1834): Unimplemented feature error in <FILENAME REMOVED>
|
||||
--> yul_unimplemented/input.sol:8:9:
|
||||
--> yul_unimplemented/input.sol:5:16:
|
||||
|
|
||||
8 | x.f();
|
||||
| ^^^^^
|
||||
5 | return type(test).name;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
pragma solidity >=0.0;
|
||||
library L { function f(uint) public {} }
|
||||
contract test {
|
||||
using L for uint;
|
||||
function f() public {
|
||||
uint x;
|
||||
x.f();
|
||||
function f() public pure returns (string memory) {
|
||||
return type(test).name;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// library: D
|
||||
|
||||
@@ -14,6 +14,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// library: D
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
library L {
|
||||
struct S {
|
||||
uint256[] data;
|
||||
}
|
||||
|
||||
function f(S memory _s) internal {
|
||||
_s.data[3] += 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
contract C {
|
||||
using L for L.S;
|
||||
|
||||
function f() public returns (uint256) {
|
||||
L.S memory x;
|
||||
x.data = new uint256[](7);
|
||||
x.data[3] = 8;
|
||||
(x.f)();
|
||||
return x.data[3];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x0a
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
library L {
|
||||
function f(string memory a) internal pure returns (string memory) {
|
||||
return a;
|
||||
}
|
||||
function g(string storage a) internal pure returns (string memory) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
using L for string;
|
||||
string s;
|
||||
|
||||
function test(string calldata x) public returns (string memory, string memory) {
|
||||
s = x;
|
||||
return (s.f(), s.g());
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test(string): 0x20, 3, "def" -> 0x40, 0x80, 3, "def", 3, "def"
|
||||
Reference in New Issue
Block a user