File tree Expand file tree Collapse file tree 6 files changed +26
-15
lines changed Expand file tree Collapse file tree 6 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ pub fn (mut a array) pop() voidptr {
270
270
}
271
271
}
272
272
new_len := a.len - 1
273
- last_elem := unsafe { & byte (a.data) + ( new_len) * a.element_size }
273
+ last_elem := unsafe { & byte (a.data) + new_len * a.element_size }
274
274
a.len = new_len
275
275
// NB: a.cap is not changed here *on purpose*, so that
276
276
// further << ops on that array will be more efficient.
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ fn test_between() {
43
43
fn test_compare () {
44
44
a := 'Music'
45
45
b := 'src'
46
- assert b > = (a)
46
+ assert b > = a
47
47
}
48
48
49
49
fn test_lt () {
@@ -53,12 +53,12 @@ fn test_lt() {
53
53
d := 'b'
54
54
e := 'aa'
55
55
f := 'ab'
56
- assert a < (b)
56
+ assert a < b
57
57
assert ! (b < c)
58
- assert c < (d)
58
+ assert c < d
59
59
assert ! (d < e)
60
- assert c < (e)
61
- assert e < (f)
60
+ assert c < e
61
+ assert e < f
62
62
}
63
63
64
64
fn test_ge () {
@@ -67,11 +67,11 @@ fn test_ge() {
67
67
c := 'ab'
68
68
d := 'abc'
69
69
e := 'aaa'
70
- assert b > = (a)
71
- assert c > = (b)
72
- assert d > = (c)
70
+ assert b > = a
71
+ assert c > = b
72
+ assert d > = c
73
73
assert ! (c > = d)
74
- assert e > = (a)
74
+ assert e > = a
75
75
}
76
76
77
77
fn test_compare_strings () {
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ const (
188
188
const (
189
189
sublang_neutral = 0x00
190
190
sublang_default = 0x01
191
- lang_neutral = ( sublang_neutral)
191
+ lang_neutral = sublang_neutral
192
192
)
193
193
194
194
// Ref - https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--12000-15999-
Original file line number Diff line number Diff line change @@ -2157,11 +2157,16 @@ pub fn (mut f Fmt) or_expr(node ast.OrExpr) {
2157
2157
}
2158
2158
2159
2159
pub fn (mut f Fmt) par_expr (node ast.ParExpr) {
2160
- f.write ('(' )
2161
- f.par_level++
2160
+ requires_paren := node.expr ! is ast.Ident
2161
+ if requires_paren {
2162
+ f.par_level++
2163
+ f.write ('(' )
2164
+ }
2162
2165
f.expr (node.expr)
2163
- f.par_level--
2164
- f.write (')' )
2166
+ if requires_paren {
2167
+ f.par_level--
2168
+ f.write (')' )
2169
+ }
2165
2170
}
2166
2171
2167
2172
pub fn (mut f Fmt) postfix_expr (node ast.PostfixExpr) {
Original file line number Diff line number Diff line change
1
+ fn main() {
2
+ _ := (cond1 && cond2) || single_ident
3
+ }
Original file line number Diff line number Diff line change
1
+ fn main() {
2
+ _ := (cond1 && cond2) || (single_ident)
3
+ }
You can’t perform that action at this time.
0 commit comments