[nullsafe] consistent models for the scrict containers

Reviewed By: mbouaziz

Differential Revision: D13977297

fbshipit-source-id: a32be3431
master
Jeremy Dubreil 6 years ago committed by Facebook Github Bot
parent 168e9099f7
commit adfd5a6418

@ -1271,6 +1271,10 @@ INTERNAL OPTIONS
--nullable-annotation-name-reset
Cancel the effect of --nullable-annotation-name.
--nullsafe-strict-containers
Activates: Warn when containers are used with nullable keys or
values (Conversely: --no-nullsafe-strict-containers)
--no-only-cheap-debug
Deactivates: Disable expensive debugging output (Conversely:
--only-cheap-debug)

@ -1639,6 +1639,11 @@ and nullable_annotation =
CLOpt.mk_string_opt ~long:"nullable-annotation-name" "Specify custom nullable annotation name"
and nullsafe_strict_containers =
CLOpt.mk_bool ~long:"nullsafe-strict-containers" ~default:false
"Warn when containers are used with nullable keys or values"
and only_footprint =
CLOpt.mk_bool ~deprecated:["only_footprint"] ~long:"only-footprint" "Skip the re-execution phase"
@ -2777,6 +2782,8 @@ and nelseg = !nelseg
and nullable_annotation = !nullable_annotation
and nullsafe_strict_containers = !nullsafe_strict_containers
and no_translate_libs = not !headers
and only_cheap_debug = !only_cheap_debug

@ -498,6 +498,8 @@ val no_translate_libs : bool
val nullable_annotation : string option
val nullsafe_strict_containers : bool
val only_cheap_debug : bool
val only_footprint : bool

@ -12,8 +12,6 @@ module Hashtbl = Caml.Hashtbl
* This file is a big bunch of tables; they read better with really long lines.
* @nolint
*)
(* in strict mode cannot insert null in containers *)
let strict_containers = false
(* in strict mode, give an error if a nullable is passed to checkNotNull *)
let check_not_null_strict = false
@ -45,16 +43,16 @@ let n3 = (o, [n; n; n])
let on = (o, [o; n])
(* container add *)
let ca = if strict_containers then (o, [o]) else (o, [n])
let ca = if Config.nullsafe_strict_containers then (o, [o]) else (o, [n])
(* container get *)
let cg = if strict_containers then (n, [o]) else (n, [n])
let cg = if Config.nullsafe_strict_containers then (n, [o]) else (n, [n])
(* container put *)
let cp = (n, [o; o])
let cp = if Config.nullsafe_strict_containers then (n, [o; o]) else (n, [n; n])
(* container remove *)
let cr = if strict_containers then (n, [o]) else (n, [n])
let cr = if Config.nullsafe_strict_containers then (n, [o]) else (n, [n])
(* nullable getter *)
let ng = (n, [])

@ -1,5 +1,6 @@
{
"external-java-packages": [
"external."
]
],
"nullsafe-strict-containers": true
}

Loading…
Cancel
Save