From 88cde776e7f37a9abead55cd85df3e3691d80c1a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 13 Aug 2020 23:21:11 +0200 Subject: [PATCH] checker: more clear string error --- vlib/v/checker/checker.v | 4 +++- vlib/v/gen/fn.v | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index d8f204ca09..fd21c7ce38 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3091,7 +3091,9 @@ pub fn (mut c Checker) index_expr(mut node ast.IndexExpr) table.Type { c.error('type `$typ_sym.name` does not support indexing', node.pos) } if typ_sym.kind == .string && !typ.is_ptr() && node.is_setter { - c.error('cannot assign to s[i] (strings are immutable)', node.pos) + c.error('cannot assign to s[i] since V strings are immutable\n' + + '(note, that variables may be mutable but string values are always immutable, like in Go and Java)', + node.pos) } if !c.inside_unsafe && (typ.is_ptr() || typ.is_pointer()) { mut is_ok := false diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index f818d79112..dceeaa58bf 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -7,9 +7,6 @@ import v.ast import v.table import v.util -pub fn kek_cheburek() { -} - fn (mut g Gen) gen_fn_decl(it ast.FnDecl, skip bool) { // TODO For some reason, build fails with autofree with this line // as it's only informative, comment it for now