Skip to content

Commit

Permalink
added warning for missing mli interface file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anukriti12 committed Apr 1, 2020
1 parent 466ed63 commit 6e7ff65
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -195,6 +195,9 @@ Working version
(Nicolás Ojeda Bär, review by Alain Frisch, Gabriel Scherer and Damien
Doligez)

- #9407: added warning for missing mli interface file
(Anukriti Kumar, review by Octachron, vicuna)

### Internal/compiler-libs changes:

- #463: a new Misc.Magic_number module for user-friendly parsing
Expand Down
2 changes: 2 additions & 0 deletions typing/typemod.ml
Expand Up @@ -2663,6 +2663,8 @@ let type_implementation sourcefile outputprefix modulename initial_env ast =
gen_annot outputprefix sourcefile annots;
(str, coercion)
end else begin
Location.prerr_warning (Location.in_file sourcefile)
Warnings.Interface_not_found;
let coercion =
Includemod.compunit initial_env ~mark:Includemod.Mark_positive
sourcefile sg "(inferred signature)" simple_sg
Expand Down
6 changes: 5 additions & 1 deletion utils/warnings.ml
Expand Up @@ -92,6 +92,7 @@ type t =
| Redefining_unit of string (* 65 *)
| Unused_open_bang of string (* 66 *)
| Unused_functor_parameter of string (* 67 *)
| Interface_not_found (* 68 *)
;;

(* If you remove a warning, leave a hole in the numbering. NEVER change
Expand Down Expand Up @@ -170,9 +171,10 @@ let number = function
| Redefining_unit _ -> 65
| Unused_open_bang _ -> 66
| Unused_functor_parameter _ -> 67
| Interface_not_found -> 68
;;

let last_warning_number = 67
let last_warning_number = 68
;;

(* Must be the max number returned by the [number] function. *)
Expand Down Expand Up @@ -631,6 +633,8 @@ let message = function
which shadows the existing one.\n\
Hint: Did you mean 'type %s = unit'?" name
| Unused_functor_parameter s -> "unused functor parameter " ^ s ^ "."
| Interface_not_found ->
"Cannot find interface file"
;;

let nerrors = ref 0;;
Expand Down
1 change: 1 addition & 0 deletions utils/warnings.mli
Expand Up @@ -94,6 +94,7 @@ type t =
| Redefining_unit of string (* 65 *)
| Unused_open_bang of string (* 66 *)
| Unused_functor_parameter of string (* 67 *)
| Interface_not_found (* 68 *)
;;

type alert = {kind:string; message:string; def:loc; use:loc}
Expand Down

0 comments on commit 6e7ff65

Please sign in to comment.