From 7da28deaafd98da7bd66b90c7baa40a9ec97e5c2 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 14 Mar 2022 14:50:53 +0000 Subject: [PATCH] fmt --- vlib/v/checker/checker.v | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index a0392ed19e..21fe61fe70 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -3763,8 +3763,8 @@ pub fn (mut c Checker) index_expr(mut node ast.IndexExpr) ast.Type { '(note, that variables may be mutable but string values are always immutable, like in Go and Java)', node.pos) } - if (typ.is_ptr() && !typ.has_flag(.shared_f) - && !node.left.is_auto_deref_var()) || typ.is_pointer() { + if (typ.is_ptr() && !typ.has_flag(.shared_f) && !node.left.is_auto_deref_var()) + || typ.is_pointer() { mut is_ok := false if mut node.left is ast.Ident { if mut node.left.obj is ast.Var { @@ -3775,8 +3775,7 @@ pub fn (mut c Checker) index_expr(mut node ast.IndexExpr) ast.Type { if !is_ok && node.index is ast.RangeExpr { s := c.table.type_to_str(typ) c.error('type `$s` does not support slicing', node.pos) - } - else if !c.inside_unsafe && !is_ok && !c.pref.translated && !c.file.is_translated { + } else if !c.inside_unsafe && !is_ok && !c.pref.translated && !c.file.is_translated { c.warn('pointer indexing is only allowed in `unsafe` blocks', node.pos) } }