Enable -principal to check ambiguous code

Summary:public
Type-based resolution of fields, constructors, etc. can be ambiguous if
types are not principal.  Compile with -principal and enable warnings 18
and 19 to check these cases.

Reviewed By: jvillard

Differential Revision: D2938237

fb-gh-sync-id: bb4237b
shipit-source-id: bb4237b
master
Josh Berdine 9 years ago committed by facebook-github-bot-5
parent 5833835289
commit 9bdd1a9d0f

@ -77,7 +77,17 @@ OCAMLBUILD_OPTIONS = \
$(OCAMLBUILD_BINANNOT_OPTIONS) \ $(OCAMLBUILD_BINANNOT_OPTIONS) \
$(OCAMLBUILD_QUIET_OPTIONS) \ $(OCAMLBUILD_QUIET_OPTIONS) \
-classic-display \ -classic-display \
-cflags -warn-error,@5@8@10..12@20@26@39 \ -cflags -principal \
-cflags -w,@5 \
-cflags -w,@8 \
-cflags -w,@10 \
-cflags -w,@11 \
-cflags -w,@12 \
-cflags -w,@18 \
-cflags -w,@19 \
-cflags -w,@20 \
-cflags -w,@26 \
-cflags -w,@39 \
-lflags $(OCAML_INCLUDES) \ -lflags $(OCAML_INCLUDES) \
-cflags $(OCAML_INCLUDES) \ -cflags $(OCAML_INCLUDES) \
$(addprefix -lib ,$(OCAML_LIBS)) \ $(addprefix -lib ,$(OCAML_LIBS)) \

@ -489,7 +489,7 @@ let dereference_string deref_str value_str access_opt loc =
[(problem_str ^ " " ^ at_line tags loc)] in [(problem_str ^ " " ^ at_line tags loc)] in
{ no_desc with descriptions = value_desc:: access_desc @ problem_desc; tags = !tags } { no_desc with descriptions = value_desc:: access_desc @ problem_desc; tags = !tags }
let parameter_field_not_null_checked_desc desc exp = let parameter_field_not_null_checked_desc (desc : error_desc) exp =
let parameter_not_nullable_desc var = let parameter_not_nullable_desc var =
let var_s = Sil.pvar_to_string var in let var_s = Sil.pvar_to_string var in
let param_not_null_desc = let param_not_null_desc =

@ -281,7 +281,7 @@ let java_is_static = function
| _ -> assert false | _ -> assert false
(** Prints a string of a java procname with the given level of verbosity *) (** Prints a string of a java procname with the given level of verbosity *)
let java_to_string ?(withclass = false) j verbosity = let java_to_string ?(withclass = false) (j : java_signature) verbosity =
match verbosity with match verbosity with
| Verbose | Non_verbose -> | Verbose | Non_verbose ->
(* if verbose, then package.class.method(params): rtype, (* if verbose, then package.class.method(params): rtype,

@ -36,7 +36,7 @@ type stack_frame =
type stack_trace = stack_frame list type stack_trace = stack_frame list
(** given [str_frame], try to resolve its components in [exe_env] *) (** given [str_frame], try to resolve its components in [exe_env] *)
let try_resolve_frame str_frame exe_env tenv = let try_resolve_frame (str_frame : str_frame) exe_env tenv =
try try
let class_name = Mangled.from_string str_frame.class_str in let class_name = Mangled.from_string str_frame.class_str in
(* find the class name in the tenv and get the procedure(s) whose names match the procedure name (* find the class name in the tenv and get the procedure(s) whose names match the procedure name

Loading…
Cancel
Save