solidity/test/libsolidity/semanticTests/constructor_with_params_diamond_inheritance.sol

30 lines
552 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-05-23 10:54:18 +00:00
// gas irOptimized: 154366
2021-11-15 15:19:33 +00:00
// gas legacy: 170665
// gas legacyOptimized: 145396
// i() -> 2
// j() -> 2
// k() -> 1