From 19a36205900809a2d177e70f8c976425847edf88 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Wed, 10 Apr 2024 14:52:15 -0500 Subject: [PATCH] Add error --- errors/src/errors/type_checker/type_checker_error.rs | 7 +++++++ 1 file changed, 7 insertions(+) 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()), + } );