diff --git a/vlib/v/checker/comptime.v b/vlib/v/checker/comptime.v index 2138ec271da756..f1348a67313cf5 100644 --- a/vlib/v/checker/comptime.v +++ b/vlib/v/checker/comptime.v @@ -668,7 +668,7 @@ fn (mut c Checker) evaluate_once_comptime_if_attribute(mut node ast.Attr) bool { if mut node.ct_expr is ast.Ident { if node.ct_opt { if node.ct_expr.name in ast.valid_comptime_not_user_defined { - c.error('option `[if expression ?]` tags, can be used only for user defined identifiers', + c.error('option `@[if expression ?]` tags, can be used only for user defined identifiers', node.pos) node.ct_skip = true } else { @@ -678,7 +678,7 @@ fn (mut c Checker) evaluate_once_comptime_if_attribute(mut node ast.Attr) bool { return node.ct_skip } else { if node.ct_expr.name !in ast.valid_comptime_not_user_defined { - c.note('`[if ${node.ct_expr.name}]` is deprecated. Use `@[if ${node.ct_expr.name} ?]` instead', + c.note('`@[if ${node.ct_expr.name}]` is deprecated. Use `@[if ${node.ct_expr.name} ?]` instead', node.pos) node.ct_skip = node.ct_expr.name !in c.pref.compile_defines node.ct_evaled = true diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 01b514f252d47e..684f48f0bb78bb 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -138,7 +138,7 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) { } if ct_attr_idx := node.attrs.find_comptime_define() { sexpr := node.attrs[ct_attr_idx].ct_expr.str() - c.error('only functions that do NOT return values can have `[if ${sexpr}]` tags', + c.error('only functions that do NOT return values can have `@[if ${sexpr}]` tags', node.pos) } if node.generic_names.len > 0 { diff --git a/vlib/v/checker/return.v b/vlib/v/checker/return.v index 14c87283a1baa3..4526fadf85f482 100644 --- a/vlib/v/checker/return.v +++ b/vlib/v/checker/return.v @@ -392,7 +392,7 @@ fn (mut c Checker) check_noreturn_fn_decl(mut node ast.FnDecl) { ast.ExprStmt { if last_stmt.expr is ast.CallExpr { if last_stmt.expr.should_be_skipped { - c.error('[noreturn] functions cannot end with a skippable `[if ..]` call', + c.error('@[noreturn] functions cannot end with a skippable `@[if ..]` call', last_stmt.pos) return } diff --git a/vlib/v/checker/tests/ctdefine.out b/vlib/v/checker/tests/ctdefine.out index 8f1043dfffd077..c9a13997d85405 100644 --- a/vlib/v/checker/tests/ctdefine.out +++ b/vlib/v/checker/tests/ctdefine.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/ctdefine.vv:4:1: error: only functions that do NOT return values can have `[if test]` tags - 2 | +vlib/v/checker/tests/ctdefine.vv:4:1: error: only functions that do NOT return values can have `@[if test]` tags + 2 | 3 | @[if test] 4 | fn only_called_in_test() string { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -8,5 +8,5 @@ vlib/v/checker/tests/ctdefine.vv:4:1: error: only functions that do NOT return v vlib/v/checker/tests/ctdefine.vv:1:1: error: project must include a `main` module or be a shared library (compile with `v -shared`) 1 | module notmain | ^ - 2 | + 2 | 3 | @[if test]