Skip to content

Treat @meth annotation as making the type uncurried. #5845

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
Nov 24, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ These are only breaking changes for unformatted code.
- Remove processing of objects expressions, which don't exist in `.res` syntax (`Pexp_object`) https://github.com/rescript-lang/rescript-compiler/pull/5841
- Remove class type processing from compiler ppx https://github.com/rescript-lang/rescript-compiler/pull/5842
- Remove method application via operator `##`, which does not exist in `.res` syntax https://github.com/rescript-lang/rescript-compiler/pull/5844
- Treat `@meth` annotation as making the type uncurried for backwards compatibitly with some examples https://github.com/rescript-lang/rescript-compiler/pull/5845

# 10.1.0-rc.6

Expand Down
4 changes: 3 additions & 1 deletion jscomp/frontend/ast_core_type_class_type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
| Uncurry _ -> Ast_typ_uncurry.to_uncurry_type loc self label args body
| Meth_callback _ ->
Ast_typ_uncurry.to_method_callback_type loc self label args body
| Method _ -> Ast_typ_uncurry.to_method_type loc self label args body
| Method _ ->
(* Treat @meth as making the type uncurried, for backwards compatibility *)
Ast_typ_uncurry.to_uncurry_type loc self label args body
| Nothing -> Bs_ast_mapper.default_mapper.typ self ty)
| { ptyp_desc = Ptyp_object (methods, closed_flag); ptyp_loc = loc } ->
let ( +> ) attr (typ : Parsetree.core_type) =
Expand Down
6 changes: 3 additions & 3 deletions jscomp/main/builtin_cmi_datasets.ml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion jscomp/test/build.ninja

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions jscomp/test/meth_annotation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';


john.say("hey", "jude");

/* Not a pure module */
6 changes: 6 additions & 0 deletions jscomp/test/meth_annotation.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// The @meth annotation is for backwards compatibility. It just makes the type uncurried.
type person = {@meth "say": (string, string) => unit}

@val external john: person = "john"

john["say"]("hey", "jude")
10 changes: 6 additions & 4 deletions lib/4.06.1/unstable/js_compiler.ml

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions lib/4.06.1/unstable/js_playground_compiler.ml

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions lib/4.06.1/whole_compiler.ml

Large diffs are not rendered by default.