Skip to content

Commit

Permalink
remove pos variance ( Bs_Map.empty has to be monomorphic), prepare mu…
Browse files Browse the repository at this point in the history
…tation
  • Loading branch information
bobzhang committed Jan 13, 2018
1 parent 927d480 commit 390ce36
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion jscomp/others/bs_Map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module N = Bs_internalAVLtree
module B = Bs_Bag
type ('key, + 'a, 'id) t0 = ('key,'a) N.t0
type ('key, 'a, 'id) t0 = ('key,'a) N.t0

type ('k,'v,'id) t =
(('k,'id) Bs_Cmp.t,
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_Map.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(***********************************************************************)
(** Adapted by authors of BuckleScript without using functors *)
(** The type of the map keys. *)
type ('k, + 'a, 'id) t0
type ('k, 'a, 'id) t0
(** [('k, 'a, id) t]
['k] the key type
['a] the value type
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapInt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module N = Bs_internalAVLtree

type ('key, 'a, 'id) t0 = ('key,'a) N.t0

type + 'a t = (key,'a) N.t0
type 'a t = (key,'a) N.t0



Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapInt.mli
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 4 "map.cppo.mli"
type key = int
# 8
type (+'a) t
type 'a t
(** The type of maps from type [key] to type ['a]. *)

val empty: 'a t
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapString.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module N = Bs_internalAVLtree

type ('key, 'a, 'id) t0 = ('key,'a) N.t0

type + 'a t = (key,'a) N.t0
type 'a t = (key,'a) N.t0



Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_MapString.mli
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 2 "map.cppo.mli"
type key = string
# 8
type (+'a) t
type 'a t
(** The type of maps from type [key] to type ['a]. *)

val empty: 'a t
Expand Down
12 changes: 6 additions & 6 deletions jscomp/others/bs_internalAVLtree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
(** Almost rewritten by authors of BuckleScript *)


type ('k, + 'v) node = {
left : ('k,'v) node Js.null;
key : 'k;
value : 'v;
right : ('k,'v) node Js.null;
h : int
type ('k, 'v) node = {
mutable left : ('k,'v) node Js.null;
mutable key : 'k;
mutable value : 'v;
mutable right : ('k,'v) node Js.null;
mutable h : int
} [@@bs.deriving abstract]

external toOpt : 'a Js.null -> 'a option = "#null_to_opt"
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/bs_internalAVLtree.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

type ('key, 'a) t0 = ('key, 'a) node Js.null

and ('k, + 'v) node = {
and ('k, 'v) node = {
left : ('k,'v) t0;
key : 'k;
value : 'v;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/map.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module N = Bs_internalAVLtree

type ('key, 'a, 'id) t0 = ('key,'a) N.t0

type + 'a t = (key,'a) N.t0
type 'a t = (key,'a) N.t0



Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/map.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type key = int
#else
[%error "unknown type"]
#endif
type (+'a) t
type 'a t
(** The type of maps from type [key] to type ['a]. *)

val empty: 'a t
Expand Down
13 changes: 13 additions & 0 deletions jscomp/test/bs_map_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var Bs_Map = require("../../lib/js/bs_Map.js");
var Bs_Set = require("../../lib/js/bs_Set.js");
var Bs_MapInt = require("../../lib/js/bs_MapInt.js");
var Caml_primitive = require("../../lib/js/caml_primitive.js");
var Bs_internalAVLset = require("../../lib/js/bs_internalAVLset.js");
var Bs_internalAVLtree = require("../../lib/js/bs_internalAVLtree.js");
Expand Down Expand Up @@ -71,16 +72,28 @@ for(var i$1 = 0; i$1 <= 100000; ++i$1){

console.log(data$1);

var M = 0;

var MI = 0;

var vv = Bs_MapInt.empty;

var vv2 = Bs_MapInt.empty;

var B = 0;

var ISet = 0;

exports.N = N;
exports.M = M;
exports.MI = MI;
exports.m0 = m0;
exports.I = I;
exports.I2 = I2;
exports.m = m;
exports.m2 = m2;
exports.vv = vv;
exports.vv2 = vv2;
exports.B = B;
exports.ISet = ISet;
/* data Not a pure module */
9 changes: 6 additions & 3 deletions jscomp/test/bs_map_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ module N =
compare x y
)
)

let m0 = Bs.Map.empty (module N)
module M = Bs.Map
module MI = Bs.MapInt
let m0 : (_,string,_) M.t = M.empty (module N)

module I = Bs.Cmp.Make(
struct
Expand All @@ -26,8 +27,10 @@ module I2 = Bs.Cmp.Make(

let m = Bs.Map.empty (module I)

let m2 = Bs.Map.empty (module I2)
let m2 : (int, string, _) M.t = M.empty (module I2)

let vv = MI.empty
let vv2 = MI.empty
module B = Bs.Bag
(* let () =
Js.log (m = m2) *)
Expand Down

0 comments on commit 390ce36

Please sign in to comment.