diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index df7548c9a4..d265099198 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -898,7 +898,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) { } ast.PrefixExpr { f.write(node.op.str()) - f.expr(node.right) + f.prefix_expr_cast_expr( node.right ) } ast.RangeExpr { f.expr(node.low) diff --git a/vlib/v/fmt/tests/star__amp_int__cast_keep.vv b/vlib/v/fmt/tests/star__amp_int__cast_keep.vv new file mode 100644 index 0000000000..73312cd5e1 --- /dev/null +++ b/vlib/v/fmt/tests/star__amp_int__cast_keep.vv @@ -0,0 +1,5 @@ +fn main() { + body := [1, 2, 3] + size := *&int(body.data) + eprintln('size: $size') +} diff --git a/vlib/v/parser/pratt.v b/vlib/v/parser/pratt.v index 7a3831bcb0..6a9084cabe 100644 --- a/vlib/v/parser/pratt.v +++ b/vlib/v/parser/pratt.v @@ -8,6 +8,10 @@ import v.table import v.token pub fn (mut p Parser) expr(precedence int) ast.Expr { + $if trace_parser ? { + tok_pos := p.tok.position() + eprintln('parsing file: ${p.file_name:-30} | tok.kind: ${p.tok.kind:-10} | tok.lit: ${p.tok.lit:-10} | tok_pos: ${tok_pos.str():-45} | expr($precedence)') + } // println('\n\nparser.expr()') mut typ := table.void_type mut node := ast.Expr{}