generalize_expansive: test that we treat missing types as abstract types

master
Thomas Refis 2018-08-06 18:32:29 +01:00 committed by Thomas Refis
parent 35006b9d88
commit b9312affa2
7 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1 @@
val foo : unit -> 'a Foo.t

View File

@ -0,0 +1 @@
let x = Bar.foo ()

View File

@ -0,0 +1 @@
type 'a t

View File

@ -0,0 +1 @@
test.ml

View File

@ -0,0 +1 @@
val x : '_weak1 Foo.t

View File

@ -0,0 +1,15 @@
(* TEST
files = "foo.mli bar.mli baz.ml"
* setup-ocamlc.byte-build-env
** ocamlc.byte
module = "foo.mli"
*** ocamlc.byte
module = "bar.mli"
**** script
script = "rm foo.cmi"
***** ocamlc.byte
flags = "-c -i"
module = "baz.ml"
ocamlc_byte_exit_status = "0"
****** check-ocamlc.byte-output
*)

View File

@ -795,7 +795,10 @@ let rec generalize_expansive env var_level visited ty =
Tconstr (path, tyl, abbrev) ->
let variance =
try (Env.find_type path env).type_variance
with Not_found -> List.map (fun _ -> Variance.may_inv) tyl in
with Not_found ->
(* See testsuite/tests/typing-missing-cmi-2 for an example *)
List.map (fun _ -> Variance.may_inv) tyl
in
abbrev := Mnil;
List.iter2
(fun v t ->