diff --git a/vlib/v/checker/tests/ptr_array_init.out b/vlib/v/checker/tests/ptr_array_init.out index dd72b47e9f..ada30a138b 100644 --- a/vlib/v/checker/tests/ptr_array_init.out +++ b/vlib/v/checker/tests/ptr_array_init.out @@ -1,7 +1,5 @@ -vlib/v/checker/tests/sum.vv:2:14: warning: arrays of references need to be initialized right away (unless used inside `unsafe`) +vlib/v/checker/tests/ptr_array_init.vv:2:14: warning: arrays of references need to be initialized right away (unless used inside `unsafe`) 1 | fn main() { 2 | println(*[]&int{len: 1}[0]) | ~~~~~~~ 3 | } - 4 | - diff --git a/vlib/v/checker/tests/shared_element_lock.out b/vlib/v/checker/tests/shared_element_lock.out index f392a1fc10..63b6a905b3 100644 --- a/vlib/v/checker/tests/shared_element_lock.out +++ b/vlib/v/checker/tests/shared_element_lock.out @@ -1,3 +1,10 @@ +vlib/v/checker/tests/shared_element_lock.vv:43:11: warning: arrays of references need to be initialized right away (unless used inside `unsafe`) + 41 | shared g := Pro{} + 42 | g.pers.age = 42 + 43 | mut h := []shared Pro{len: 3} + | ~~~~~~~~~~~~~ + 44 | h[2].pers.age = 42 + 45 | println(h[2].pers.age) vlib/v/checker/tests/shared_element_lock.vv:36:5: error: `pr.pe` is `shared` and needs explicit lock for `v.ast.SelectorExpr` 34 | } 35 | } diff --git a/vlib/v/eval/expr.v b/vlib/v/eval/expr.v index f6bbf78fe6..d4a2ecd47f 100644 --- a/vlib/v/eval/expr.v +++ b/vlib/v/eval/expr.v @@ -513,7 +513,7 @@ pub fn (mut e Eval) expr(expr ast.Expr, expecting ast.Type) Object { ast.ChanInit, ast.Comment, ast.ComptimeCall, ast.ComptimeSelector, ast.ComptimeType, ast.ConcatExpr, ast.DumpExpr, ast.EmptyExpr, ast.EnumVal, ast.GoExpr, ast.IfGuardExpr, ast.IndexExpr, ast.IsRefType, ast.Likely, ast.LockExpr, ast.MapInit, ast.MatchExpr, - ast.NodeError, ast.None, ast.OffsetOf, ast.OrExpr, ast.RangeExpr, ast.SelectExpr, + ast.Nil, ast.NodeError, ast.None, ast.OffsetOf, ast.OrExpr, ast.RangeExpr, ast.SelectExpr, ast.SqlExpr, ast.TypeNode, ast.TypeOf, ast.UnsafeExpr { e.error('unhandled expression ${typeof(expr).name}') } diff --git a/vlib/v/gen/golang/golang.v b/vlib/v/gen/golang/golang.v index cbf23187af..3bec5f910a 100644 --- a/vlib/v/gen/golang/golang.v +++ b/vlib/v/gen/golang/golang.v @@ -597,6 +597,7 @@ pub fn (mut f Gen) expr(node_ ast.Expr) { ast.MatchExpr { f.match_expr(node) } + ast.Nil {} ast.None { f.write('none') } diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 23c8b0b543..2aa5cde636 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -959,6 +959,7 @@ fn (mut g JsGen) expr(node_ ast.Expr) { ast.LockExpr { g.gen_lock_expr(node) } + ast.Nil {} ast.NodeError {} ast.Nil { g.write('null') diff --git a/vlib/v/preludes/test_runner_normal.v b/vlib/v/preludes/test_runner_normal.v index 39f7ddafc2..c219a50d93 100644 --- a/vlib/v/preludes/test_runner_normal.v +++ b/vlib/v/preludes/test_runner_normal.v @@ -33,13 +33,15 @@ mut: } fn new_normal_test_runner() &TestRunner { - mut tr := &NormalTestRunner{} - tr.use_color = term.can_show_color_on_stderr() - tr.use_relative_paths = match os.getenv('VERROR_PATHS') { - 'absolute' { false } - else { true } + unsafe { + mut tr := &NormalTestRunner{} + tr.use_color = term.can_show_color_on_stderr() + tr.use_relative_paths = match os.getenv('VERROR_PATHS') { + 'absolute' { false } + else { true } + } + return tr } - return tr } fn (mut runner NormalTestRunner) free() {