diff --git a/src/action.ml b/src/action.ml index e5ae3cf4..110c6739 100644 --- a/src/action.ml +++ b/src/action.ml @@ -1061,7 +1061,11 @@ module Infer = struct module Unexp = Make(Unexpanded.Uast)(S_unexp)(Outcome_unexp)(struct open Outcome_unexp - let ( +@ ) acc fn = { acc with targets = fn :: acc.targets } + let ( +@ ) acc fn = + if SW.is_var fn ~name:"null" then + acc + else + { acc with targets = fn :: acc.targets } let ( +< ) acc _ = acc let ( + String.concat ~sep:"" let sexp_of_t t = Sexp.To_sexp.string (to_string t) + +let is_var t ~name = + match t.items with + | [Var (_, v)] -> v = name + | _ -> false diff --git a/src/string_with_vars.mli b/src/string_with_vars.mli index 0b02380b..14afb0f4 100644 --- a/src/string_with_vars.mli +++ b/src/string_with_vars.mli @@ -43,6 +43,8 @@ val iter : t -> f:(Loc.t -> string -> unit) -> unit (** [iter t ~f] iterates [f] over all variables of [t], the text portions being ignored. *) +val is_var : t -> name:string -> bool + module type EXPANSION = sig type t (** The value to which variables are expanded. *) diff --git a/test/blackbox-tests/test-cases/null-dep/run.t b/test/blackbox-tests/test-cases/null-dep/run.t index 972d5375..c3b3574c 100644 --- a/test/blackbox-tests/test-cases/null-dep/run.t +++ b/test/blackbox-tests/test-cases/null-dep/run.t @@ -1,4 +1 @@ $ jbuilder runtest --debug-dependency-path - File "jbuild", line 5, characters 26-33: - Warning: Aliases must not have targets, this target will be ignored. - This will become an error in the future.