mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
trigger error when runtimeCode is called on contracts with immutables
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
contract A {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(A).creationCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
contract A {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(A).runtimeCode;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (153-172): "runtimeCode" is not available for contracts containing immutable variables.
|
||||
@@ -0,0 +1,13 @@
|
||||
contract Base {
|
||||
address public immutable user = address(0x0);
|
||||
}
|
||||
|
||||
contract Derived is Base {}
|
||||
|
||||
contract Test {
|
||||
function test() public pure returns(bytes memory) {
|
||||
return type(Derived).runtimeCode;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (185-210): "runtimeCode" is not available for contracts containing immutable variables.
|
||||
Reference in New Issue
Block a user