v2 / vlib / v / fmt / tests / infix_expr_keep.vv
15 lines · 14 sloc · 745 bytes · f5e6cadf6320dd568f95695916ab5f9394cc605d
Raw
1fn infix_in_multi_assign() {
2 child_width, child_height = child.adj_width + child.margin(.left) + child.margin(.right),
3 child.adj_height + child.margin(.top) + child.margin(.bottom)
4}
5
6fn impostor_infix() {
7 /*
8 String concatiation is an InfixExpr. The second part is so long
9 that it overflows a single line. Therefore the wrapping logic is run.
10 The problem was that `&&` and `||` inside the string were detected as infix operators.
11 Thus causing a totally wrong wrapping and sometimes runtime panics.
12 */
13 x := 'foo' +
14 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || (eeeeeeeeeeeeeeeeee && ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) && bbbbbbbbbbbbbbbbbbbbbbbbbbbb'
15}
16