From b5d9096f1512761418fc69145d7a983b3ce80400 Mon Sep 17 00:00:00 2001 From: Drup Date: Tue, 23 Jun 2015 15:00:18 +0200 Subject: [PATCH 1/2] Small fix to avoid init in ppx tests. --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 002ebbfb23..984f42b22e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -36,7 +36,7 @@ clean: rm -f camlp4/*.cm[io] camlp4/*.result ppx/%.result: ppx/%.ml - TERM=dumb ocaml -noprompt -I ../lib -ppx ../lib/ppx/ppx_js < $< | tail -n +2 > $@ + TERM=dumb ocaml -noinit -noprompt -I ../lib -ppx ../lib/ppx/ppx_js < $< | tail -n +2 > $@ ppx/test_%: ppx/%.result ppx/%.expected diff $? From 3ad0748b1e6ad05764f4eb7ddb944a536d801d51 Mon Sep 17 00:00:00 2001 From: Drup Date: Tue, 23 Jun 2015 15:01:27 +0200 Subject: [PATCH 2/2] Fix camlp4 tests. --- tests/camlp4/meth.expected | 31 +++++++++++++++---------------- tests/camlp4/meth.ml | 29 +++++++---------------------- tests/camlp4/prop.expected | 21 ++++++++++----------- tests/camlp4/prop.ml | 18 ++++-------------- tests/camlp4/write_prop.expected | 26 +++++++++++++------------- tests/camlp4/write_prop.ml | 21 +++++---------------- 6 files changed, 54 insertions(+), 92 deletions(-) diff --git a/tests/camlp4/meth.expected b/tests/camlp4/meth.expected index 35afc46407..466efeadcb 100644 --- a/tests/camlp4/meth.expected +++ b/tests/camlp4/meth.expected @@ -1,39 +1,38 @@ Characters 40-43: - fun (obj : int) -> obj##m + fun (obj : int) -> obj##m();; ^^^ Error: This expression has type int but an expression was expected of type - < .. > Js.t + 'a Js.t Characters 25-28: - fun (obj : < > Js.t) -> obj##m + fun (obj : < > Js.t) -> obj##m();; ^^^ Error: This expression has type < > It has no method m Characters 43-49: - fun (obj : < m : float Js.prop > Js.t) -> obj##m + fun (obj : < m : float Js.prop > Js.t) -> obj##m();; ^^^^^^ Error: This expression has type float Js.prop = < get : float; set : float -> unit > Js.gen_prop - but an expression was expected of type 'jsoo_32b5ee21 Js.meth -Characters 43-49: - fun (obj : < m : float Js.meth > Js.t) -> obj##m + 1 - ^^^^^^ + but an expression was expected of type 'a Js.meth +Characters 43-51: + fun (obj : < m : float Js.meth > Js.t) -> obj##m() + 1;; + ^^^^^^^^ Error: This expression has type float but an expression was expected of type int Characters 48-54: - fun (obj : < m : int -> int Js.meth > Js.t) -> obj##m + 1 + fun (obj : < m : int -> int Js.meth > Js.t) -> obj##m() + 1;; ^^^^^^ Error: This expression has type int -> int Js.meth - but an expression was expected of type 'jsoo_32b5ee21 Js.meth + but an expression was expected of type 'a Js.meth Characters 41-47: - fun (obj : < m : int Js.meth > Js.t) -> obj##m 1 + fun (obj : < m : int Js.meth > Js.t) -> obj##m(1);; ^^^^^^ Error: This expression has type int Js.meth - but an expression was expected of type - 'jsoo_173316d7 -> 'jsoo_29529091 Js.meth -Characters 50-58: - fun (obj : < m : int -> float Js.meth > Js.t) -> obj##m 1 + 1 - ^^^^^^^^ + but an expression was expected of type 'a -> 'b Js.meth +Characters 50-59: + fun (obj : < m : int -> float Js.meth > Js.t) -> obj##m(1) + 1;; + ^^^^^^^^^ Error: This expression has type float but an expression was expected of type int diff --git a/tests/camlp4/meth.ml b/tests/camlp4/meth.ml index d8881a1cda..b74cbcb310 100644 --- a/tests/camlp4/meth.ml +++ b/tests/camlp4/meth.ml @@ -1,30 +1,15 @@ -(* dummy "let _ = 3" are to work arround ... camlp4 weirdness I guess *) (* Test methods. *) -let x1 = fun (obj : int) -> obj##m();; +fun (obj : int) -> obj##m();; -let _ = 3;; let _ = 3;; +fun (obj : < > Js.t) -> obj##m();; -let x2 = fun (obj : < > Js.t) -> obj##m();; +fun (obj : < m : float Js.prop > Js.t) -> obj##m();; -let _ = 3;; let _ = 3;; +fun (obj : < m : float Js.meth > Js.t) -> obj##m() + 1;; -let x3 = fun (obj : < m : float Js.prop > Js.t) -> obj##m();; +fun (obj : < m : int -> int Js.meth > Js.t) -> obj##m() + 1;; -let _ = 3;; let _ = 3;; +fun (obj : < m : int Js.meth > Js.t) -> obj##m(1);; -let x4 = fun (obj : < m : float Js.meth > Js.t) -> obj##m() + 1;; - -let _ = 3;; let _ = 3;; - -let x5 = fun (obj : < m : int -> int Js.meth > Js.t) -> obj##m() + 1;; - -let _ = 3;; let _ = 3;; - -let x6 = fun (obj : < m : int Js.meth > Js.t) -> obj##m(1);; - -let _ = 3;; let _ = 3;; - -let x7 = fun (obj : < m : int -> float Js.meth > Js.t) -> obj##m(1) + 1;; - -let _ = 3;; let _ = 3;; +fun (obj : < m : int -> float Js.meth > Js.t) -> obj##m(1) + 1;; diff --git a/tests/camlp4/prop.expected b/tests/camlp4/prop.expected index fe15489648..70f105d9d5 100644 --- a/tests/camlp4/prop.expected +++ b/tests/camlp4/prop.expected @@ -1,25 +1,24 @@ Characters 45-48: - fun (obj : int) -> obj##.p + fun (obj : int) -> obj##p;; ^^^ Error: This expression has type int but an expression was expected of type - < .. > Js.t + 'a Js.t Characters 25-28: - fun (obj : < > Js.t) -> obj##.p + fun (obj : < > Js.t) -> obj##p;; ^^^ Error: This expression has type < > It has no method p -Characters 53-60: - fun (obj : < p : float Js.writeonly_prop > Js.t) -> obj##.p + 1 - ^^^^^^^ +Characters 53-59: + fun (obj : < p : float Js.writeonly_prop > Js.t) -> obj##p + 1;; + ^^^^^^ Error: This expression has type float Js.writeonly_prop = < set : float -> unit > Js.gen_prop - but an expression was expected of type - < get : 'jsoo_res; .. > Js.gen_prop + but an expression was expected of type < get : 'a; .. > Js.gen_prop The first object type has no method get -Characters 43-50: - fun (obj : < p : float Js.prop > Js.t) -> obj##.p + 1 - ^^^^^^^ +Characters 43-49: + fun (obj : < p : float Js.prop > Js.t) -> obj##p + 1;; + ^^^^^^ Error: This expression has type float but an expression was expected of type int diff --git a/tests/camlp4/prop.ml b/tests/camlp4/prop.ml index 4a4a005a31..8ba27c586f 100644 --- a/tests/camlp4/prop.ml +++ b/tests/camlp4/prop.ml @@ -1,19 +1,9 @@ -(* dummy "let _ = 3" are to work arround ... camlp4 weirdness I guess *) (* Test prop reading. *) -let x1 = fun (obj : int) -> obj##p;; +fun (obj : int) -> obj##p;; -let _ = 3;; let _ = 3;; +fun (obj : < > Js.t) -> obj##p;; -let x2 = fun (obj : < > Js.t) -> obj##p;; - -let _ = 3;; let _ = 3;; - -let x3 = fun (obj : < p : float Js.writeonly_prop > Js.t) -> obj##p + 1;; - -let _ = 3;; let _ = 3;; - -let x4 = fun (obj : < p : float Js.prop > Js.t) -> obj##p + 1;; - -let _ = 3;; let _ = 3;; +fun (obj : < p : float Js.writeonly_prop > Js.t) -> obj##p + 1;; +fun (obj : < p : float Js.prop > Js.t) -> obj##p + 1;; diff --git a/tests/camlp4/write_prop.expected b/tests/camlp4/write_prop.expected index edbb3ff631..9233528e9e 100644 --- a/tests/camlp4/write_prop.expected +++ b/tests/camlp4/write_prop.expected @@ -1,30 +1,30 @@ Characters 45-48: - fun (obj : int) -> obj##.p := 2 + fun (obj : int) -> obj##p <- 2;; ^^^ Error: This expression has type int but an expression was expected of type - < .. > Js.t + 'a Js.t Characters 25-28: - fun (obj : < > Js.t) -> obj##.p := 2 + fun (obj : < > Js.t) -> obj##p <- 2;; ^^^ Error: This expression has type < > It has no method p -Characters 52-59: - fun (obj : < p : float Js.readonly_prop > Js.t) -> obj##.p := 1 - ^^^^^^^ +Characters 52-58: + fun (obj : < p : float Js.readonly_prop > Js.t) -> obj##p <- 1;; + ^^^^^^ Error: This expression has type float Js.readonly_prop = < get : float > Js.gen_prop but an expression was expected of type - < set : 'jsoo_arg -> unit; .. > Js.gen_prop + < set : 'a -> unit; .. > Js.gen_prop The first object type has no method set -Characters 54-55: - fun (obj : < p : float Js.prop > Js.t) -> obj##.p := 1 - ^ +Characters 53-54: + fun (obj : < p : float Js.prop > Js.t) -> obj##p <- 1;; + ^ Error: This expression has type int but an expression was expected of type float -Characters 41-55: - fun (obj : < p : int Js.prop > Js.t) -> (obj##.p := 1) + 1 - ^^^^^^^^^^^^^^ +Characters 42-53: + fun (obj : < p : int Js.prop > Js.t) -> (obj##p <- 1) + 1;; + ^^^^^^^^^^^ Error: This expression has type unit but an expression was expected of type int diff --git a/tests/camlp4/write_prop.ml b/tests/camlp4/write_prop.ml index 6040be0a65..5a98a2bb3e 100644 --- a/tests/camlp4/write_prop.ml +++ b/tests/camlp4/write_prop.ml @@ -1,22 +1,11 @@ -(* dummy "let _ = 3" are to work arround ... camlp4 weirdness I guess *) (* Test prop writing. *) -let x1 = fun (obj : int) -> obj##p <- 2;; +fun (obj : int) -> obj##p <- 2;; -let _ = 3;; let _ = 3;; +fun (obj : < > Js.t) -> obj##p <- 2;; -let x2 = fun (obj : < > Js.t) -> obj##p <- 2;; +fun (obj : < p : float Js.readonly_prop > Js.t) -> obj##p <- 1;; -let _ = 3;; let _ = 3;; +fun (obj : < p : float Js.prop > Js.t) -> obj##p <- 1;; -let x3 = fun (obj : < p : float Js.readonly_prop > Js.t) -> obj##p <- 1;; - -let _ = 3;; let _ = 3;; - -let x4 = fun (obj : < p : float Js.prop > Js.t) -> obj##p <- 1;; - -let _ = 3;; let _ = 3;; - -let x5 = fun (obj : < p : int Js.prop > Js.t) -> (obj##p <- 1) + 1;; - -let _ = 3;; let _ = 3;; +fun (obj : < p : int Js.prop > Js.t) -> (obj##p <- 1) + 1;;