Compile‑time error when reassigning an immutable variable to its current value in Vyper
0 reputation · 30 Oct 2021, 15:20 UTC
Goal: Determine whether the Vyper compiler treats a reassignment that gives an immutable variable the same value it already holds as a permissible no‑op or as a violation of the immutability rule.
Constraint: The language specification states that immutables cannot be modified after deployment, but it does not explicitly say whether assigning an identical value counts as a modification.
Uncertainty: Developers have reported mixed behavior when using patterns such as conditional initialization that re‑assign an immutable to its current value, and it is unclear if the compiler’s error message includes the variable name and source location or if this behavior is stable across recent Vyper releases.
Questions: Does the compiler emit an error when reassigning an immutable to its current value? Does the error message contain the variable name and line number? Is this behavior consistent across Vyper 0.2.x, 0.3.x and later versions?