Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/versioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/analyzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current_container_name) {
if let Some(Value::ContainerDefinition(def)) =
env.borrow().get(&current_container_name)
{
if let Some(parent_name) = &def.extends {
current_container_name = parent_name.clone();
if let Some(Value::ContainerDefinition(parent_def)) =
Expand Down
18 changes: 10 additions & 8 deletions src/typechecker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions tests/colon_consumption_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
63 changes: 31 additions & 32 deletions tests/container_ast_corruption_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
}
}
}