@@ -251,11 +251,13 @@ let parse_property_attribute attr property =
251
251
| Some {Parsetree. attr_name = {txt; loc} ; attr_payload = payload } ->
252
252
parse_ids_payload txt loc
253
253
~default: Default_check
254
- ~empty: (Check { property; strict = false ; loc; } )
254
+ ~empty: (Check { property; strict = false ; opt = false ; loc; } )
255
255
[
256
256
[" assume" ],
257
257
Assume { property; strict = false ; never_returns_normally = false ; loc; };
258
- [" strict" ], Check { property; strict = true ; loc; };
258
+ [" strict" ], Check { property; strict = true ; opt = false ; loc; };
259
+ [" opt" ], Check { property; strict = false ; opt = true ; loc; };
260
+ [" opt" ; " strict" ; ], Check { property; strict = true ; opt = true ; loc; };
259
261
[" assume" ; " strict" ],
260
262
Assume { property; strict = true ; never_returns_normally = false ; loc; };
261
263
[" assume" ; " never_returns_normally" ],
@@ -312,8 +314,8 @@ let get_property_attribute l p =
312
314
| None , (Check _ | Assume _ | Ignore_assert_all _ ) -> assert false
313
315
| Some _ , Ignore_assert_all _ -> ()
314
316
| Some _ , Assume _ -> ()
315
- | Some attr , Check _ ->
316
- if ! Clflags. zero_alloc_check && ! Clflags. native_code then
317
+ | Some attr , Check { opt; _ } ->
318
+ if Lambda. is_check_enabled ~opt p && ! Clflags. native_code then
317
319
(* The warning for unchecked functions will not trigger if the check is requested
318
320
through the [@@@zero_alloc all] top-level annotation rather than through the
319
321
function annotation [@zero_alloc]. *)
0 commit comments