From 53872373bf02f8bf174c56d40b1ff9b3f81d2d81 Mon Sep 17 00:00:00 2001 From: Sofia Date: Thu, 16 Apr 2026 19:47:56 +0300 Subject: [PATCH] Check for const in assignment binop --- src/typechecker.cpp | 2 +- test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typechecker.cpp b/src/typechecker.cpp index 1c1bf99..2f351be 100644 --- a/src/typechecker.cpp +++ b/src/typechecker.cpp @@ -177,7 +177,7 @@ namespace AST { if (!lhs_res.lvalue) { state.errors.push_back(CompileError("Value must be a modifiable l-value", this->m_lhs->m_meta)); } - else if (lhs_ty->m_kind == types::TypeKind::Array) { + else if (lhs_ty->m_const) { state.errors.push_back(CompileError("Value must be a modifiable l-value", this->m_lhs->m_meta)); } diff --git a/test.c b/test.c index adf8cc9..d6d8ae9 100644 --- a/test.c +++ b/test.c @@ -6,7 +6,7 @@ int fibonacci(int n) { return fibonacci(n - 1) + fibonacci(n - 2); } -void change_first(const char* otus) { +void change_first(char* otus) { otus[0] = 115; }