From 3a9355d898da39bed366760bfbd641110af4c434 Mon Sep 17 00:00:00 2001 From: Makhnev Petr <51853996+i582@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:05:34 +0400 Subject: [PATCH] change `or{}` to `or {}` as most other places (#17082) --- CHANGELOG.md | 2 +- vlib/v/checker/checker.v | 2 +- vlib/v/checker/tests/map_index_reference_value.out | 2 +- vlib/v/gen/c/cgen.v | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e27b32138d..cdbcf8a7d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## V 0.3.3 *Not yet released* -- Accessing a pointer map value requires an `or{}` block outside `unsafe`. +- Accessing a pointer map value requires an `or {}` block outside `unsafe`. - `math.vec` module for generic vector math. - `go foo()` has been replaced with `spawn foo()` (launches an OS thread, `go` will be used for upcoming coroutines instead). diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index b12602ac9f..988b9f7823 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3874,7 +3874,7 @@ fn (mut c Checker) index_expr(mut node ast.IndexExpr) ast.Type { && typ_sym.kind == .map && node.or_expr.stmts.len == 0 { elem_type := c.table.value_type(typ) if elem_type.is_real_pointer() { - c.note('accessing a pointer map value requires an `or{}` block outside `unsafe`', + c.note('accessing a pointer map value requires an `or {}` block outside `unsafe`', node.pos) } } diff --git a/vlib/v/checker/tests/map_index_reference_value.out b/vlib/v/checker/tests/map_index_reference_value.out index cdd1cb355d..227fa1c678 100644 --- a/vlib/v/checker/tests/map_index_reference_value.out +++ b/vlib/v/checker/tests/map_index_reference_value.out @@ -1,4 +1,4 @@ -vlib/v/checker/tests/map_index_reference_value.vv:7:3: notice: accessing a pointer map value requires an `or{}` block outside `unsafe` +vlib/v/checker/tests/map_index_reference_value.vv:7:3: notice: accessing a pointer map value requires an `or {}` block outside `unsafe` 5 | fn main() { 6 | mut m := map[string]&Foo{} 7 | m['bar'].bar = 'bar' diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 233aaad828..b96fa36d9e 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2937,7 +2937,7 @@ fn (mut g Gen) autofree_scope_vars2(scope &ast.Scope, start_pos int, end_pos int if obj.is_or { // Skip vars inited with the `or {}`, since they are generated // after the or block in C. - g.trace_autofree('// skipping `or{}` var "${obj.name}"') + g.trace_autofree('// skipping `or {}` var "${obj.name}"') continue } if obj.is_tmp {