From 0a6c9c4d4eb908466c23718e073e6d0b3f166225 Mon Sep 17 00:00:00 2001 From: Brad Byrd Date: Tue, 12 Aug 2025 07:47:02 -0500 Subject: [PATCH 1/3] Updates dependencies Bumps the version of the `wfl` dependency to 25.8.28 in the `Cargo.lock` file. This change ensures the project uses the latest version of this crate. Files Changed: - `Cargo.lock` Explanation: - The `wfl` package version is updated from `25.8.26` to `25.8.28`. --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index a581a88b..1c2d55e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3029,7 +3029,7 @@ dependencies = [ [[package]] name = "wfl" -version = "25.8.26" +version = "25.8.28" dependencies = [ "chrono", "codespan-reporting", From 4f577fc4b116655ec1b8d514f664ec1cfdb88cbf Mon Sep 17 00:00:00 2001 From: Brad Byrd Date: Tue, 12 Aug 2025 08:00:54 -0500 Subject: [PATCH 2/3] Fix formatting --- .claude/settings.local.json | 3 ++- .github/workflows/versioning.yml | 2 +- src/analyzer/mod.rs | 7 +++---- src/interpreter/mod.rs | 4 +++- src/typechecker/mod.rs | 18 ++++++++++-------- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index e5afb86b..2e286b06 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -42,7 +42,8 @@ "Bash(../target/debug/wfl.exe --parse containers_comprehensive.wfl)", "Bash(.targetdebugwfl.exe --parse TestProgramscontainers_comprehensive.wfl)", "Bash(.targetreleasewfl.exe TestProgramstest_redefinition_error.wfl)", - "Bash(git fetch:*)" + "Bash(git fetch:*)", + "Bash(git tag:*)" ], "deny": [] } diff --git a/.github/workflows/versioning.yml b/.github/workflows/versioning.yml index f462d329..6afe1869 100644 --- a/.github/workflows/versioning.yml +++ b/.github/workflows/versioning.yml @@ -37,7 +37,7 @@ jobs: git fetch --tags # Extract version from version.rs - VERSION=$(grep -oP '(?<=VERSION: &str = ")[0-9]+\.[0-9]+' src/version.rs) + VERSION=$(grep -oP '(?<=VERSION: &str = ")[0-9]+\.[0-9]+\.[0-9]+' src/version.rs) # Check if this version tag already exists if ! git tag -l | grep -q "^v$VERSION$"; then diff --git a/src/analyzer/mod.rs b/src/analyzer/mod.rs index 4ec7849f..08a7e4ca 100644 --- a/src/analyzer/mod.rs +++ b/src/analyzer/mod.rs @@ -400,10 +400,9 @@ impl Analyzer { // This is actually a property assignment, not a variable declaration // Don't treat it as an error - the interpreter will handle it - if !is_property_assignment - && let Err(error) = self.current_scope.define(symbol) { - self.errors.push(error); - } + if !is_property_assignment && let Err(error) = self.current_scope.define(symbol) { + self.errors.push(error); + } } Statement::Assignment { name, diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 3a9ddf79..8ce11687 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -2999,7 +2999,9 @@ impl Interpreter { // If method not found, check parent containers while found_method.is_none() { - if let Some(Value::ContainerDefinition(def)) = env.borrow().get(¤t_container_name) { + if let Some(Value::ContainerDefinition(def)) = + env.borrow().get(¤t_container_name) + { if let Some(parent_name) = &def.extends { current_container_name = parent_name.clone(); if let Some(Value::ContainerDefinition(parent_def)) = diff --git a/src/typechecker/mod.rs b/src/typechecker/mod.rs index eadbf28b..197d2e9c 100644 --- a/src/typechecker/mod.rs +++ b/src/typechecker/mod.rs @@ -356,18 +356,20 @@ impl TypeChecker { // Check if we're in a container method and this is a property assignment if let Some(ref container_name) = self.current_container && let Some(container_info) = self.analyzer.get_container(container_name) - && container_info.properties.contains_key(name) { - // This is a container property assignment - is_container_property_assignment = true; - } + && container_info.properties.contains_key(name) + { + // This is a container property assignment + is_container_property_assignment = true; + } // Also check if the analyzer has this symbol (fallback) if !is_container_property_assignment && let Some(symbol) = self.analyzer.get_symbol(name) - && symbol.symbol_type.is_some() { - // Variable already exists with a known type - is_container_property_assignment = true; - } + && symbol.symbol_type.is_some() + { + // Variable already exists with a known type + is_container_property_assignment = true; + } } if inferred_type == Type::Unknown && !is_container_property_assignment { From 0a1771811b13ef6a0bfdd541239348b8737eb87a Mon Sep 17 00:00:00 2001 From: Brad Byrd Date: Tue, 12 Aug 2025 08:08:38 -0500 Subject: [PATCH 3/3] Refactor tests for improved clarity and style Improves the test suite by adopting modern Rust syntax and removing redundant code. - `tests/container_ast_corruption_test.rs`: Flattens nested `if let` statements into a single `let` chain, reducing nesting and improving readability. - `tests/colon_consumption_test.rs`: Removes a redundant `assert!(true)` statement. The test's success is implicitly confirmed by it not panicking. --- tests/colon_consumption_test.rs | 3 +- tests/container_ast_corruption_test.rs | 63 +++++++++++++------------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/tests/colon_consumption_test.rs b/tests/colon_consumption_test.rs index bf1286b2..f17934a9 100644 --- a/tests/colon_consumption_test.rs +++ b/tests/colon_consumption_test.rs @@ -40,8 +40,7 @@ end } } - // If no specific colon errors, the test passes - assert!(true, "No double colon consumption detected"); + // If we reach here without panicking, no double colon consumption was detected } #[test] diff --git a/tests/container_ast_corruption_test.rs b/tests/container_ast_corruption_test.rs index 9834b102..7c5640a6 100644 --- a/tests/container_ast_corruption_test.rs +++ b/tests/container_ast_corruption_test.rs @@ -95,48 +95,47 @@ end let program = result.unwrap(); - if let Statement::ContainerDefinition { methods, .. } = &program.statements[0] { - if let Statement::ActionDefinition { + if let Statement::ContainerDefinition { methods, .. } = &program.statements[0] + && let Statement::ActionDefinition { name, parameters, body, .. } = &methods[0] - { - assert_eq!(name, "set_name"); - assert_eq!(parameters.len(), 1); - assert_eq!(parameters[0].name, "new_name"); - assert_eq!(body.len(), 1); + { + assert_eq!(name, "set_name"); + assert_eq!(parameters.len(), 1); + assert_eq!(parameters[0].name, "new_name"); + assert_eq!(body.len(), 1); - // Check that the store statement has correct structure - if let Statement::VariableDeclaration { - name: var_name, - value, - .. - } = &body[0] - { - assert_eq!(var_name, "name"); - if let Expression::Variable(param_name, line, column) = value { - assert_eq!(param_name, "new_name"); - // This should point to the parameter usage in the action body - assert_eq!(*line, 6, "Parameter usage should be on line 6"); - assert!( - *column > 20, - "Parameter should be at reasonable column in store statement, got column {}", - column - ); - } else { - panic!( - "Store value should be a variable reference to new_name, got: {:?}", - value - ); - } + // Check that the store statement has correct structure + if let Statement::VariableDeclaration { + name: var_name, + value, + .. + } = &body[0] + { + assert_eq!(var_name, "name"); + if let Expression::Variable(param_name, line, column) = value { + assert_eq!(param_name, "new_name"); + // This should point to the parameter usage in the action body + assert_eq!(*line, 6, "Parameter usage should be on line 6"); + assert!( + *column > 20, + "Parameter should be at reasonable column in store statement, got column {}", + column + ); } else { panic!( - "Action body should contain a store statement, got: {:?}", - body[0] + "Store value should be a variable reference to new_name, got: {:?}", + value ); } + } else { + panic!( + "Action body should contain a store statement, got: {:?}", + body[0] + ); } } }