File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -230,17 +230,13 @@ let lazy_or_assert_or_await_expr_rhs ?(in_await = false) expr =
230
230
Parenthesized
231
231
| _ -> Nothing )
232
232
233
- let is_prefixed_constant constant =
234
- let is_prefix txt =
233
+ let is_negative_constant constant =
234
+ let is_neg txt =
235
235
let len = String. length txt in
236
- len > 0
237
- &&
238
- match (String. get [@ doesNotRaise]) txt 0 with
239
- | '-' | '~' -> true
240
- | _ -> false
236
+ len > 0 && (String. get [@ doesNotRaise]) txt 0 = '-'
241
237
in
242
238
match constant with
243
- | (Parsetree. Pconst_integer (i , _ ) | Pconst_float (i , _ )) when is_prefix i ->
239
+ | (Parsetree. Pconst_integer (i , _ ) | Pconst_float (i , _ )) when is_neg i ->
244
240
true
245
241
| _ -> false
246
242
@@ -264,7 +260,7 @@ let field_expr expr =
264
260
Pexp_constraint ({pexp_desc = Pexp_pack _}, {ptyp_desc = Ptyp_package _});
265
261
} ->
266
262
Nothing
267
- | {pexp_desc = Pexp_constant c } when is_prefixed_constant c -> Parenthesized
263
+ | {pexp_desc = Pexp_constant c } when is_negative_constant c -> Parenthesized
268
264
| {pexp_desc = Pexp_fun _}
269
265
when ParsetreeViewer. is_underscore_apply_sugar expr ->
270
266
Nothing
You can’t perform that action at this time.
0 commit comments