Semantic test where constructor has a function as parameter

This commit is contained in:
hrkrshnn 2021-02-12 20:01:01 +01:00
parent 0135cae222
commit e24a23edcd
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// The IR of this test used to throw
contract D {
constructor(function() external returns (uint)) {
}
}
// ====
// compileViaYul: also
// ----
// constructor(): 0xfdd67305928fcac8d213d1e47bfa6165cd0b87b946644cd0000000000000000 ->

View File

@ -0,0 +1,21 @@
contract D {
uint public x;
constructor(function() external pure returns (uint) g) {
x = g();
}
}
contract C {
function f() public returns (uint r) {
D d = new D(this.sixteen);
r = d.x();
}
function sixteen() public pure returns (uint) {
return 16;
}
}
// ====
// compileViaYul: also
// ----
// f() -> 16