Skip to content

Version 11.1.2-rc.1 #6812

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 9 commits into from
Jun 16, 2024
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
> - :house: [Internal]
> - :nail_care: [Polish]

# 11.1.2-rc.1

#### :rocket: New Feature

- Support Windows 11 ARM (using the x64 binaries in emulation). https://github.com/rescript-lang/rescript-compiler/pull/6813

#### :bug: Bug Fix

- Fix location of let bindings with attributes. https://github.com/rescript-lang/rescript-compiler/pull/6791
- PPX v4: mark props type in externals as `@live` to avoid dead code warnings for prop fields in the editor tooling. https://github.com/rescript-lang/rescript-compiler/pull/6796
- Fix issue where optional labels were not taken into account when disambiguating record value construction. https://github.com/rescript-lang/rescript-compiler/pull/6798
- Fix issue in gentype when type `Jsx.element` surfaces to the user. https://github.com/rescript-lang/rescript-compiler/pull/6808
- Fix inclusion check (impl vs interface) for untagged variants, and fix the outcome printer to show tags. https://github.com/rescript-lang/rescript-compiler/pull/6669
- Fix encoding inside tagged template literals. https://github.com/rescript-lang/rescript-compiler/pull/6810

# 11.1.1

#### :bug: Bug Fix
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

We've found a bug for you!
/.../fixtures/UntaggedImplIntf.res:3:5-5:1

1 │ module M: {
2 │ @unboxed type t = | @as(null) A
3 │ } = {
4 │  type t = | @as(null) A
5 │ }

Signature mismatch:
Modules do not match:
{
type t = @as(null) A
}
is not included in
{
@unboxed type t = @as(null) A
}
Type declarations do not match:
type t = @as(null) A
is not included in
@unboxed type t = @as(null) A
/.../fixtures/UntaggedImplIntf.res:2:12-33:
Expected declaration
/.../fixtures/UntaggedImplIntf.res:4:3-24:
Actual declaration
Their internal representations differ:
the second declaration uses unboxed representation.
5 changes: 5 additions & 0 deletions jscomp/build_tests/super_errors/fixtures/UntaggedImplIntf.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module M: {
@unboxed type t = | @as(null) A
} = {
type t = | @as(null) A
}
2 changes: 1 addition & 1 deletion jscomp/common/bs_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
let version = "11.1.1"
let version = "11.1.2-rc.1"
let header = "// Generated by ReScript, PLEASE EDIT WITH CARE"
let package_name = ref "rescript"
3 changes: 2 additions & 1 deletion jscomp/gentype/TranslateTypeExprFromTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv =
{dependencies = []; type_ = EmitType.typeReactEventMouseT}
| ( ( ["React"; "element"]
| ["ReactV3"; "React"; "element"]
| ["ReasonReact"; "reactElement"] ),
| ["ReasonReact"; "reactElement"]
| [("Pervasives" | "PervasivesU"); "Jsx"; "element"] ),
[] ) ->
{dependencies = []; type_ = EmitType.typeReactElement}
| (["FB"; "option"] | ["option"]), [paramTranslation] ->
Expand Down
6 changes: 4 additions & 2 deletions jscomp/ml/includecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,10 @@ let type_declarations ?(equality = false) ~loc env name decl1 id decl2 =
in
if err <> [] then err else
let err =
match (decl2.type_kind, decl1.type_unboxed.unboxed,
decl2.type_unboxed.unboxed) with
let untagged1 = Ast_untagged_variants.process_untagged decl1.type_attributes in
let untagged2 = Ast_untagged_variants.process_untagged decl2.type_attributes in
match (decl2.type_kind, decl1.type_unboxed.unboxed || untagged1,
decl2.type_unboxed.unboxed || untagged2) with
| Type_abstract, _, _ -> []
| _, true, false -> [Unboxed_representation false]
| _, false, true -> [Unboxed_representation true]
Expand Down
17 changes: 10 additions & 7 deletions jscomp/ml/oprint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -499,13 +499,13 @@ and print_out_signature ppf =
match items with
Osig_typext(ext, Oext_next) :: items ->
gather_extensions
((ext.oext_name, ext.oext_args, ext.oext_ret_type) :: acc)
((ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr) :: acc)
items
| _ -> (List.rev acc, items)
in
let exts, items =
gather_extensions
[(ext.oext_name, ext.oext_args, ext.oext_ret_type)]
[(ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr)]
items
in
let te =
Expand All @@ -531,7 +531,7 @@ and print_out_sig_item ppf =
name !out_class_type clt
| Osig_typext (ext, Oext_exception) ->
fprintf ppf "@[<2>exception %a@]"
print_out_constr (ext.oext_name, ext.oext_args, ext.oext_ret_type)
print_out_constr (ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr)
| Osig_typext (ext, _es) ->
print_out_extension_constructor ppf ext
| Osig_modtype (name, Omty_abstract) ->
Expand Down Expand Up @@ -639,7 +639,10 @@ and print_out_type_decl kwd ppf td =
print_immediate
print_unboxed

and print_out_constr ppf (name, tyl,ret_type_opt) =
and print_out_constr ppf (name, tyl, ret_type_opt, repr) =
let () = match repr with
| None -> ()
| Some s -> pp_print_string ppf s in
let name =
match name with
| "::" -> "(::)" (* #7200 *)
Expand Down Expand Up @@ -686,7 +689,7 @@ and print_out_extension_constructor ppf ext =
fprintf ppf "@[<hv 2>type %t +=%s@;<1 2>%a@]"
print_extended_type
(if ext.oext_private = Asttypes.Private then " private" else "")
print_out_constr (ext.oext_name, ext.oext_args, ext.oext_ret_type)
print_out_constr (ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr)

and print_out_type_extension ppf te =
let print_extended_type ppf =
Expand Down Expand Up @@ -736,13 +739,13 @@ let rec print_items ppf =
match items with
(Osig_typext(ext, Oext_next), None) :: items ->
gather_extensions
((ext.oext_name, ext.oext_args, ext.oext_ret_type) :: acc)
((ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr) :: acc)
items
| _ -> (List.rev acc, items)
in
let exts, items =
gather_extensions
[(ext.oext_name, ext.oext_args, ext.oext_ret_type)]
[(ext.oext_name, ext.oext_args, ext.oext_ret_type, ext.oext_repr)]
items
in
let te =
Expand Down
5 changes: 3 additions & 2 deletions jscomp/ml/outcometree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type out_type =
| Otyp_object of (string * out_type) list * bool option
| Otyp_record of (string * bool * bool * out_type) list
| Otyp_stuff of string
| Otyp_sum of (string * out_type list * out_type option) list
| Otyp_sum of (string * out_type list * out_type option * string option) list
| Otyp_tuple of out_type list
| Otyp_var of bool * string
| Otyp_variant of
Expand Down Expand Up @@ -118,11 +118,12 @@ and out_extension_constructor =
oext_type_params: string list;
oext_args: out_type list;
oext_ret_type: out_type option;
oext_repr: string option;
oext_private: Asttypes.private_flag }
and out_type_extension =
{ otyext_name: string;
otyext_params: string list;
otyext_constructors: (string * out_type list * out_type option) list;
otyext_constructors: (string * out_type list * out_type option * string option) list;
otyext_private: Asttypes.private_flag }
and out_val_decl =
{ oval_name: string;
Expand Down
22 changes: 19 additions & 3 deletions jscomp/ml/printtyp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ let rec tree_of_type_decl id decl =
in
let (name, args) = type_defined decl in
let constraints = tree_of_constraints params in
let untagged = ref false in
let ty, priv =
match decl.type_kind with
| Type_abstract ->
Expand All @@ -890,6 +891,7 @@ let rec tree_of_type_decl id decl =
tree_of_typexp false ty, decl.type_private
end
| Type_variant cstrs ->
untagged := Ast_untagged_variants.process_untagged decl.type_attributes;
tree_of_manifest (Otyp_sum (List.map tree_of_constructor cstrs)),
decl.type_private
| Type_record(lbls, _rep) ->
Expand All @@ -907,7 +909,7 @@ let rec tree_of_type_decl id decl =
otype_type = ty;
otype_private = priv;
otype_immediate = immediate;
otype_unboxed = decl.type_unboxed.unboxed;
otype_unboxed = decl.type_unboxed.unboxed || !untagged;
otype_cstrs = constraints ;
}

Expand All @@ -917,16 +919,29 @@ and tree_of_constructor_arguments = function

and tree_of_constructor cd =
let name = Ident.name cd.cd_id in
let nullary = Ast_untagged_variants.is_nullary_variant cd.cd_args in
let repr =
if not nullary then None
else match Ast_untagged_variants.process_tag_type cd.cd_attributes with
| Some Null -> Some "@as(null)"
| Some Undefined -> Some "@as(undefined)"
| Some (String s) -> Some (Printf.sprintf "@as(%S)" s)
| Some (Int i) -> Some (Printf.sprintf "@as(%d)" i)
| Some (Float f) -> Some (Printf.sprintf "@as(%s)" f)
| Some (Bool b) -> Some (Printf.sprintf "@as(%b)" b)
| Some (BigInt s) -> Some (Printf.sprintf "@as(%sn)" s)
| Some (Untagged _) (* should never happen *)
| None -> None in
let arg () = tree_of_constructor_arguments cd.cd_args in
match cd.cd_res with
| None -> (name, arg (), None)
| None -> (name, arg (), None, repr)
| Some res ->
let nm = !names in
names := [];
let ret = tree_of_typexp false res in
let args = arg () in
names := nm;
(name, args, Some ret)
(name, args, Some ret, repr)

and tree_of_label l =
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "ns.optional" || txt = "res.optional") in
Expand Down Expand Up @@ -982,6 +997,7 @@ let tree_of_extension_constructor id ext es =
oext_type_params = ty_params;
oext_args = args;
oext_ret_type = ret;
oext_repr = None;
oext_private = ext.ext_private }
in
let es =
Expand Down
18 changes: 15 additions & 3 deletions jscomp/ml/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ let extract_concrete_variant env ty =
| (p0, p, {type_kind=Type_open}) -> (p0, p, [])
| _ -> raise Not_found

let has_optional_labels ld =
match ld.lbl_repres with
| Record_optional_labels _ -> true
| Record_inlined {optional_labels} -> optional_labels <> []
| _ -> false

let label_is_optional ld =
match ld.lbl_repres with
| Record_optional_labels lbls -> Ext_list.mem_string lbls ld.lbl_name
Expand Down Expand Up @@ -843,9 +849,15 @@ let disambiguate_label_by_ids keep closed ids labels =
let check_ids (lbl, _) =
let lbls = Hashtbl.create 8 in
Array.iter (fun lbl -> Hashtbl.add lbls lbl.lbl_name ()) lbl.lbl_all;
List.for_all (Hashtbl.mem lbls) ids
and check_closed (lbl, _) =
(not closed || List.length ids = Array.length lbl.lbl_all)
List.for_all (Hashtbl.mem lbls) ids in
let mandatory_labels_are_present num_ids lbl = (* check that all mandatory labels are present *)
if has_optional_labels lbl then (
let mandatory_lbls = ref 0 in
Ext_array.iter lbl.lbl_all (fun l -> if not (label_is_optional l) then incr mandatory_lbls);
num_ids >= !mandatory_lbls)
else num_ids = Array.length lbl.lbl_all in
let check_closed (lbl, _) =
(not closed || mandatory_labels_are_present (List.length ids) lbl)
in
let labels' = Ext_list.filter labels check_ids in
if keep && labels' = [] then (false, labels) else
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/belt_Set.cppo.resi
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let intersect: (t, t) => t
let diff: (t, t) => t

/**
`subset(s1, s20` tests whether the set `s1` is a subset of the set `s2`.
`subset(s1, s2)` tests whether the set `s1` is a subset of the set `s2`.
*/
let subset: (t, t) => bool

Expand Down
29 changes: 13 additions & 16 deletions jscomp/others/belt_SetInt.resi
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

/***
This module is [`Belt.Set`]() specialized with value type to be a primitive type.
It is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,
and identity is not needed(using the built-in one)
This module is [`Belt.Set`]() specialized with value type to be a primitive type.
It is more efficient in general, the API is the same with [`Belt_Set`]() except its value type is fixed,
and identity is not needed(using the built-in one)

**See** [`Belt.Set`]()
**See** [`Belt.Set`]()
*/

/** The type of the set elements. */
Expand All @@ -47,14 +47,14 @@ let isEmpty: t => bool
let has: (t, value) => bool

/**
`add(s, x)` if `x` was already in `s`, `s` is returned unchanged.
`add(s, x)` If `x` was already in `s`, `s` is returned unchanged.
*/
let add: (t, value) => t

let mergeMany: (t, array<value>) => t

/**
`remove(m, x)` if `x` was not in `m`, `m` is returned reference unchanged.
`remove(m, x)` If `x` was not in `m`, `m` is returned reference unchanged.
*/
let remove: (t, value) => t

Expand All @@ -77,7 +77,7 @@ of sets.
*/
let cmp: (t, t) => int

/**
/**
`eq(s1, s2)` tests whether the sets `s1` and `s2` are equal, that is, contain
equal elements.
*/
Expand All @@ -97,15 +97,15 @@ let reduce: (t, 'a, ('a, value) => 'a) => 'a

let everyU: (t, (. value) => bool) => bool

/**
/**
`every(p, s)` checks if all elements of the set satisfy the predicate `p`. Order
unspecified.
*/
let every: (t, value => bool) => bool

let someU: (t, (. value) => bool) => bool

/**
/**
`some(p, s)` checks if at least one element of the set satisfies the predicate
`p`. Oder unspecified.
*/
Expand Down Expand Up @@ -149,13 +149,10 @@ let getUndefined: (t, value) => Js.undefined<value>
let getExn: (t, value) => value

/**
`split(x, s)` returns a triple `(l, present, r)`, where
`l` is the set of elements of `s` that are
strictly less than `x`;
`r` is the set of elements of `s` that are
strictly greater than `x`;
`present` is `false` if `s` contains no element equal to `x`,
or `true` if `s` contains an element equal to `x`.
`split(x, s)` returns a triple `(l, present, r)`, where `l` is the set of
elements of `s` that are strictly less than `x`;`r` is the set of elements of
`s` that are strictly greater than `x`; `present` is `false` if `s` contains no
element equal to `x`, or `true` if `s` contains an element equal to `x`.
*/
let split: (t, value) => ((t, t), bool)

Expand Down
Loading