From bd8270bd5dc814222bb9b5f74820dd9d13714533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20H=C3=B6lting?= <87192362+moritz-hoelting@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:55:47 +0200 Subject: [PATCH] fix semantic analysis to allow assignment to indexed identifier --- src/semantic/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/semantic/mod.rs b/src/semantic/mod.rs index 015af4d..7b72328 100644 --- a/src/semantic/mod.rs +++ b/src/semantic/mod.rs @@ -393,12 +393,22 @@ impl Assignment { if let Some(variable_type) = variable_type { let expected = match variable_type { - VariableType::BooleanStorage | VariableType::Tag => ValueType::Boolean, + VariableType::BooleanStorage => ValueType::Boolean, VariableType::ScoreboardValue => ValueType::Integer, VariableType::ComptimeValue => { // TODO: check if the expression is a constant expression return Ok(()); } + VariableType::BooleanStorageArray | VariableType::Tag + if matches!(self.destination(), AssignmentDestination::Indexed(..)) => + { + ValueType::Boolean + } + VariableType::Scoreboard | VariableType::ScoreboardArray + if matches!(self.destination(), AssignmentDestination::Indexed(..)) => + { + ValueType::Integer + } _ => { let err = error::Error::AssignmentError(AssignmentError { identifier: self.destination().span(),