solidity/test/libsolidity/syntaxTests/immutable/complex.sol
2022-04-01 23:41:18 -05:00

9 lines
260 B
Solidity

contract A {
int immutable a;
constructor() { a = 5; }
function f() public { a += 7; }
}
// ----
// TypeError 1581: (83-84='a'): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor.