summaryrefslogtreecommitdiff
path: root/tests/features
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features')
-rw-r--r--tests/features/test_bool_mutability.zc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/features/test_bool_mutability.zc b/tests/features/test_bool_mutability.zc
new file mode 100644
index 0000000..553e871
--- /dev/null
+++ b/tests/features/test_bool_mutability.zc
@@ -0,0 +1,15 @@
+
+test "boolean_mutability" {
+ // Regression test for issue where 'var b = true' was inferred as const
+ var b = true;
+ assert(b, "Expected true");
+
+ // This assignment should be valid (previously failed with 'Cannot assign to const variable')
+ b = false;
+ assert(!b, "Expected false after assignment");
+
+ // Verify explicit type works too
+ var c: bool = true;
+ c = false;
+ assert(!c, "Expected false for explicit type");
+}