diff --git a/errors/src/errors/type_checker/type_checker_error.rs b/errors/src/errors/type_checker/type_checker_error.rs index 854489acf7..b4aee8c73e 100644 --- a/errors/src/errors/type_checker/type_checker_error.rs +++ b/errors/src/errors/type_checker/type_checker_error.rs @@ -775,4 +775,11 @@ create_messages!( msg: format!("Cannot use operation `{operation}` on external mapping."), help: Some("The only valid operations on external mappings are get, and get_or_use.".to_string()), } + + @formatted + finalize_cannot_assign_to_outer_scope { + args: (variable: impl Display), + msg: format!("Cannot re-assign to `{variable}` in an outer scope in a finalize block."), + help: Some("This is a fundamental restriction that can often be avoided by using a ternary operator `?` or re-declaring the variable in the current scope. In the future, ARC XXXX (https://github.com/AleoHQ/ARCs) will support more complex assignments in finalize blocks.".to_string()), + } );