solidity/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol

31 lines
560 B
Solidity
Raw Normal View History

contract A {
uint public i;
uint public k;
2020-06-23 12:14:24 +00:00
constructor(uint newI, uint newK) {
i = newI;
k = newK;
}
}
abstract contract B is A {
uint public j;
2020-06-23 12:14:24 +00:00
constructor(uint newJ) {
j = newJ;
}
}
contract C is A {
2020-06-23 12:14:24 +00:00
constructor(uint newI, uint newK) A(newI, newK) {}
}
contract D is B, C {
2020-06-23 12:14:24 +00:00
constructor(uint newI, uint newK) B(newI) C(newI, newK + 1) {}
}
// ====
// ----
// constructor(): 2, 0 ->
2022-03-15 16:25:35 +00:00
// gas irOptimized: 156071
2021-11-15 15:19:33 +00:00
// gas legacy: 170665
// gas legacyOptimized: 145396
// i() -> 2
// j() -> 2
// k() -> 1