aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2026-05-01 22:42:23 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2026-05-01 22:42:23 +0300
commitf1e9860ab638594e95db0ada848157b860eeb831 (patch)
tree8af9cd30f766f39f52e14c83572ee0c002c390a7
parent47dfe9ab7a4a658ece8b8cca08489d53758b249b (diff)
downloadfwd-f1e9860ab638594e95db0ada848157b860eeb831.tar.gz
fwd-f1e9860ab638594e95db0ada848157b860eeb831.zip
add type_mismatch test
-rw-r--r--src/debug.c2
-rw-r--r--tests/type_mismatch/test.mk1
-rw-r--r--tests/type_mismatch/type_mismatch.fwd5
3 files changed, 6 insertions, 2 deletions
diff --git a/src/debug.c b/src/debug.c
index d229ae6..273fbb0 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -156,8 +156,6 @@ void type_mismatch(struct scope *scope, struct ast *node,
char *ls = type_str(l);
char *rs = type_str(r);
semantic_error(scope, node, "type mismatch: %s vs %s\n", ls, rs);
- free(ls);
- free(rs);
}
void move_error(struct ast *new_use, struct ast *prev_use)
diff --git a/tests/type_mismatch/test.mk b/tests/type_mismatch/test.mk
new file mode 100644
index 0000000..3f589d9
--- /dev/null
+++ b/tests/type_mismatch/test.mk
@@ -0,0 +1 @@
+XFAIL += type_mismatch,'type_mismatch.fwd:4:12: error: type mismatch: i32 vs i64'
diff --git a/tests/type_mismatch/type_mismatch.fwd b/tests/type_mismatch/type_mismatch.fwd
new file mode 100644
index 0000000..e837740
--- /dev/null
+++ b/tests/type_mismatch/type_mismatch.fwd
@@ -0,0 +1,5 @@
+takes_i32(i32 n) {}
+
+main() {
+ takes_i32(20);
+}