solidity/test/libsolidity/semanticTests/immutable/inheritance.sol

33 lines
428 B
Solidity
Raw Normal View History

2020-03-12 16:32:10 +00:00
contract A {
uint8 immutable a;
2020-06-23 12:14:24 +00:00
constructor() {
2020-03-12 16:32:10 +00:00
a = 4;
}
}
contract B is A {
uint8 immutable b;
2020-06-23 12:14:24 +00:00
constructor() {
2020-03-12 16:32:10 +00:00
b = 3;
}
}
contract C is A {
uint8 immutable c;
2020-06-23 12:14:24 +00:00
constructor() {
2020-03-12 16:32:10 +00:00
c = 2;
}
}
contract D is B, C {
uint8 immutable d;
2020-06-23 12:14:24 +00:00
constructor() {
2020-03-12 16:32:10 +00:00
d = 1;
}
function f() public view returns (uint256, uint256, uint, uint) {
return (a, b, c, d);
}
}
2020-04-02 18:06:52 +00:00
// ====
// compileViaYul: also
2020-03-12 16:32:10 +00:00
// ----
// f() -> 4, 3, 2, 1