diff --git a/infer/src/nullsafe/InferredNullability.ml b/infer/src/nullsafe/InferredNullability.ml index e8f017efa..55a98fbb0 100644 --- a/infer/src/nullsafe/InferredNullability.ml +++ b/infer/src/nullsafe/InferredNullability.ml @@ -39,9 +39,9 @@ let join t1 t2 = t2.origin | false, false | true, true -> (* Nullability is not fully determined by neither t1 nor t2 - Let TypeOrigin logic to decide what to prefer in this case. + Picking the left one for stability *) - TypeOrigin.join t1.origin t2.origin + t1.origin in {nullability= joined_nullability; origin= joined_origin} diff --git a/infer/src/nullsafe/typeOrigin.ml b/infer/src/nullsafe/typeOrigin.ml index c99c2b57d..01416d1ca 100644 --- a/infer/src/nullsafe/typeOrigin.ml +++ b/infer/src/nullsafe/typeOrigin.ml @@ -194,13 +194,3 @@ let get_description origin = (* A technical origin *) | OptimisticFallback -> None - - -let join o1 o2 = - match (o1, o2) with - | Field _, (NullConst _ | NonnullConst _ | CurrMethodParameter _ | This | MethodCall _ | New) -> - (* low priority to Field, to support field initialization patterns *) - o2 - | _ -> - (* left priority *) - o1 diff --git a/infer/src/nullsafe/typeOrigin.mli b/infer/src/nullsafe/typeOrigin.mli index 44d29a89a..1bf7ba8a4 100644 --- a/infer/src/nullsafe/typeOrigin.mli +++ b/infer/src/nullsafe/typeOrigin.mli @@ -52,8 +52,5 @@ val get_nullability : t -> Nullability.t val get_description : t -> string option (** Get a description to be used for error messages. *) -val join : t -> t -> t -(** Join with left priority *) - val to_string : t -> string (** Raw string representation. *)