From be75fa736816bb37a5acd7ae233b55d5735d21cd Mon Sep 17 00:00:00 2001 From: ychenfo Date: Thu, 24 Mar 2022 07:13:13 +0800 Subject: [PATCH] nac3core: fix assign to constant --- nac3core/src/typecheck/function_check.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nac3core/src/typecheck/function_check.rs b/nac3core/src/typecheck/function_check.rs index 26fa0c40..b23821ae 100644 --- a/nac3core/src/typecheck/function_check.rs +++ b/nac3core/src/typecheck/function_check.rs @@ -46,6 +46,9 @@ impl<'a> Inferencer<'a> { } Ok(()) } + ExprKind::Constant { .. } => { + Err(format!("cannot assign to a constant (at {})", pattern.location)) + } _ => self.check_expr(pattern, defined_identifiers), } }