From 3d4b8dffdf9b0a09884153c7c7ef2a239a58054b Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 4 May 2022 08:28:24 +0300 Subject: [PATCH] checker: temporary c2v const fix --- vlib/v/checker/checker.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 102db9ef8a..62b7b52f0c 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1187,7 +1187,9 @@ fn (mut c Checker) fail_if_immutable(expr_ ast.Expr) (string, token.Pos) { } } } else if expr.obj is ast.ConstField && expr.name in c.const_names { - if !c.inside_unsafe { + if !c.inside_unsafe && !c.pref.translated { + // TODO fix this in c2v, do not allow modification of all consts + // in translated code c.error('cannot modify constant `$expr.name`', expr.pos) } }