diff --git a/infer/src/absint/PatternMatch.ml b/infer/src/absint/PatternMatch.ml index 01e88976c..4c62b8f66 100644 --- a/infer/src/absint/PatternMatch.ml +++ b/infer/src/absint/PatternMatch.ml @@ -36,15 +36,15 @@ let rec supertype_exists tenv pred name = -> false let rec supertype_find_map_opt tenv f name = - match Tenv.lookup tenv name with - | Some ({supers} as struct_typ) -> ( - match f name struct_typ with - | None + match f name with + | None -> ( + match Tenv.lookup tenv name with + | Some {supers} -> List.find_map ~f:(supertype_find_map_opt tenv f) supers - | result - -> result ) - | None - -> None + | None + -> None ) + | result + -> result let is_immediate_subtype tenv this_type_name super_type_name = match Tenv.lookup tenv this_type_name with diff --git a/infer/src/absint/PatternMatch.mli b/infer/src/absint/PatternMatch.mli index 8488e83cc..80533417a 100644 --- a/infer/src/absint/PatternMatch.mli +++ b/infer/src/absint/PatternMatch.mli @@ -51,8 +51,7 @@ val is_subtype_of_str : Tenv.t -> Typ.Name.t -> string -> bool val supertype_exists : Tenv.t -> (Typ.Name.t -> Typ.Struct.t -> bool) -> Typ.Name.t -> bool (** Holds iff the predicate holds on a supertype of the named type, including the type itself *) -val supertype_find_map_opt : - Tenv.t -> (Typ.Name.t -> Typ.Struct.t -> 'a option) -> Typ.Name.t -> 'a option +val supertype_find_map_opt : Tenv.t -> (Typ.Name.t -> 'a option) -> Typ.Name.t -> 'a option (** Return the first non-None result found when applying the given function to supertypes of the named type, including the type itself *) diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index c4a3b3003..8a1cbce0d 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -138,7 +138,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct match pn with | Typ.Procname.Java java_pname -> let typename = Typ.Name.Java.from_string (Typ.Procname.java_get_class_name java_pname) in - let get_container_access_ typename _ = + let get_container_access_ typename = match (Typ.Name.name typename, Typ.Procname.java_get_method java_pname) with | ( ("android.util.SparseArray" | "android.support.v4.util.SparseArrayCompat") , ( "append" | "clear" | "delete" | "put" | "remove" | "removeAt" | "removeAtRange" diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index d8808e931..18cbf03be 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -55,7 +55,7 @@ module SourceKind = struct | "com.facebook.infer.builtins.InferTaint", "inferSecretSource" -> Some (Other, return) | class_name, method_name - -> let taint_matching_supertype typename _ = + -> let taint_matching_supertype typename = match (Typ.Name.name typename, method_name) with | "android.app.Activity", "getIntent" -> Some (Intent, return) @@ -113,7 +113,7 @@ module SourceKind = struct | "codetoanalyze.java.quandary.TaintedFormals", "taintedContextBad" -> taint_formals_with_types ["java.lang.Integer"; "java.lang.String"] Other formals | class_name, method_name - -> let taint_matching_supertype typename _ = + -> let taint_matching_supertype typename = match (Typ.Name.name typename, method_name) with | "android.app.Activity", ("onActivityResult" | "onNewIntent") -> Some (taint_formals_with_types ["android.content.Intent"] Intent formals) @@ -234,7 +234,7 @@ module SinkKind = struct | "com.facebook.infer.builtins.InferTaint", "inferSensitiveSink" -> taint_nth 0 Other | class_name, method_name - -> let taint_matching_supertype typename _ = + -> let taint_matching_supertype typename = match (Typ.Name.name typename, method_name) with | "android.app.Activity", ("startActivityFromChild" | "startActivityFromFragment") -> taint_nth 1 StartComponent