Skip to content

[feature] fix #406 for better error message #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions jscomp/ppx_entry.ml
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ let find_uncurry_attrs_and_remove (attrs : Parsetree.attributes ) =
| _ -> false ) attrs


let uncurry_attr loc : Parsetree.attribute =
{txt = "uncurry"; loc}, PStr []


let uncurry_fn_type loc ty ptyp_attributes
(args : Parsetree.core_type ) body : Parsetree.core_type =
let open Parsetree in
Expand Down Expand Up @@ -677,7 +673,12 @@ let rec unsafe_mapper : Ast_mapper.mapper =
body)},
_)}])
->
handle_uncurry_generation loc pat body e mapper
begin match body.pexp_desc with
| Pexp_fun _ ->
Location.raise_errorf ~loc
"`fun %%uncurry (param0, param1) -> ` instead of `fun %%uncurry param0 param1 ->` "
| _ -> handle_uncurry_generation loc pat body e mapper
end
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident "#@"; loc}},
[("", fn);
("", pat)])
Expand Down
4 changes: 4 additions & 0 deletions jscomp/test/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ array_test.cmj : ../stdlib/pervasives.cmi mt.cmi ../stdlib/list.cmi \
../stdlib/array.cmi array_test.cmi
array_test.cmx : ../stdlib/pervasives.cmx mt.cmx ../stdlib/list.cmx \
../stdlib/array.cmx array_test.cmi
attr_test.cmj :
attr_test.cmx :
b.cmj :
b.cmx :
basic_module_test.cmj : ../stdlib/set.cmi pr6726.cmj offset.cmj \
Expand Down Expand Up @@ -705,6 +707,8 @@ array_test.cmo : ../stdlib/pervasives.cmi mt.cmi ../stdlib/list.cmi \
../stdlib/array.cmi array_test.cmi
array_test.cmj : ../stdlib/pervasives.cmj mt.cmj ../stdlib/list.cmj \
../stdlib/array.cmj array_test.cmi
attr_test.cmo :
attr_test.cmj :
b.cmo :
b.cmj :
basic_module_test.cmo : ../stdlib/set.cmi pr6726.cmo offset.cmo \
Expand Down
2 changes: 1 addition & 1 deletion jscomp/test/a.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ module U = Make(Test_order)
include N
(* let v = "xhg" *)
(* let () = v.[0] <- 'a' *)

(* let u = fun %uncurry x y -> x + y *)
end : sig end)
87 changes: 87 additions & 0 deletions jscomp/test/attr_test.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

let u = fun [@uncurry] (x,y) -> x + y

let h = u (1,2) [@uncurry]

type u = < v : int ; y : int > [@uncurry]

type number = float

class type date =
object [@uncurry]
method toDateString : unit -> string
method toTimeString : unit -> string
method toLocaleString : unit -> string
method toLocaleDateString : unit -> string
method toLocaleTimeString : unit -> string
method valueOf : unit -> number
method getTime : unit -> number
method getFullYear : unit -> number
method getUTCFullYear : unit -> number
method getMonth : unit -> number
method getUTCMonth : unit -> number
method getDate : unit -> number
method getUTCDate : unit -> number
method getDay : unit -> number
method getUTCDay : unit -> number
method getHours : unit -> number
method getUTCHours : unit -> number
method getMinutes : unit -> number
method getUTCMinutes : unit -> number
method getSeconds : unit -> number
method getUTCSeconds : unit -> number
method getMilliseconds : unit -> number
method getUTCMilliseconds : unit -> number
method getTimezoneOffset : unit -> number
method setTime : number -> number

method setMilliseconds : number -> number
method setUTCMilliseconds : number -> number

method setSeconds : number -> number
method setSeconds__2 : number * number -> number

method setUTCSeconds : number -> number
method setUTCSeconds__2 : number * number -> number

method setMinutes : number -> number
method setMinutes__2 : number * number -> number
method setMinutes__3 : number * number * number -> number

method setUTCMinutes : number -> number
method setUTCMinutes__2 : number * number -> number
method setUTCMinutes__3 : number * number * number -> number

method setHours : number -> number
method setHours__2 : number * number -> number
method setHours__3 : number * number * number -> number
method setHours__4 : number * number * number * number -> number

method setUTCHours : number -> number
method setUTCHours__2 : number * number -> number
method setUTCHours__3 : number * number * number -> number
method setUTCHours__4 : number * number * number * number -> number



method setDate : number -> number
method setUTCDate : number -> number
method setMonth : number -> number
method setMonth__2 : number * number -> number
method setUTCMonth : number * number
method setUTCMonth__2 : number * number -> number


method setFullYear : number -> number
method setFullYear__2 : number * number -> number
method setFullYear__3 : number * number * number -> number

method setUTCFullYear : number -> number
method setUTCFullYear__2 : number * number -> number
method setUTCFullYear__3 : number * number * number -> number

method toUTCString : unit -> string
method toISOString : unit -> string
method toJSON__ : unit -> string
method toJSON__1 : 'a -> string
end
4 changes: 3 additions & 1 deletion jscomp/test/test.mllib
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,6 @@ test_index

obj_literal_ppx_test
obj_literal_ppx
gpr_405_test
gpr_405_test

attr_test
16 changes: 16 additions & 0 deletions lib/js/test/attr_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// GENERATED CODE BY BUCKLESCRIPT VERSION 0.5.0 , PLEASE EDIT WITH CARE
'use strict';


function u(param) {
return param[0] + param[1] | 0;
}

var h = u(/* tuple */[
1,
2
]);

exports.u = u;
exports.h = h;
/* h Not a pure module */
2 changes: 1 addition & 1 deletion ocaml
Submodule ocaml updated from 75c594 to a967bc