Skip to content
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
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ jobs:
pkg-pr-new:
needs:
- build-compiler
outputs:
commit_sha: ${{ steps.publish.outputs.sha }}
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
Expand All @@ -497,6 +499,7 @@ jobs:
git diff --exit-code packages/artifacts.json

- name: Publish packages to pkg.pr.new
id: publish
run: |
yarn dlx pkg-pr-new publish "." "./packages/@rescript/*"

Expand Down Expand Up @@ -528,6 +531,7 @@ jobs:
fi

- name: Use Node.js
if: steps.diffcheck.outputs.clean == 'false'
uses: actions/setup-node@v6
with:
cache: yarn
Expand Down Expand Up @@ -586,9 +590,9 @@ jobs:

- name: Install ReScript package
run: |
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
npm i --no-audit \
"https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
"https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}

Expand Down Expand Up @@ -640,8 +644,8 @@ jobs:

- name: Install ReScript package
run: |
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
pnpm i "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
pnpm i "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}

Expand Down Expand Up @@ -675,8 +679,8 @@ jobs:

- name: Install ReScript package in rewatch/testrepo
run: |
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}"
shell: bash
working-directory: rewatch/testrepo

Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
> - :nail_care: [Polish]
> - :house: [Internal]

# 12.2.0

#### :boom: Breaking Change

- Stdlib: Added Array.zip, Array.unzip, Array.zipBy, and Array.partition. https://github.com/rescript-lang/rescript/pull/8244

#### :bug: Bug fix

- Fix compiler crash (`Fatal error: Parmatch.all_record_args`) when matching empty dict/record patterns. https://github.com/rescript-lang/rescript/pull/8246
- Fix `null` falling into the object branch instead of the wildcard when pattern matching on untagged variants with both `Object` and `null` cases. https://github.com/rescript-lang/rescript/pull/8253

# 12.2.0-rc.1

#### :boom: Breaking Change
Expand Down
29 changes: 8 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
Copyright (C) 2015-2016 Bloomberg Finance L.P.
Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
This repository contains code under multiple licenses.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
- compiler/: LGPL-3.0-or-later
- compiler/syntax/: MIT
- packages/@rescript/runtime/: MIT
- rewatch/: MIT

In addition to the permissions granted to you by the LGPL, you may combine
or link a "work that uses the Library" with a publicly distributed version
of this file to produce a combined library or application, then distribute
that combined work under the terms of your choosing, with no requirement
to comply with the obligations normally placed on you by section 4 of the
LGPL version 3 (or the corresponding section of a later version of the LGPL
should you choose to use a later version).
See full license texts:

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

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.
- LGPL-3.0-or-later: COPYING.LESSER (and COPYING where applicable)
- MIT: LICENSE.MIT
3 changes: 2 additions & 1 deletion compiler/syntax/LICENSE → LICENSE.MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2020 - Authors of ReScript
Copyright (c) 2015-2016 Bloomberg Finance L.P.
Copyright (c) 2017- Hongbo Zhang, Authors of ReScript

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p align="center">
<a href="https://www.npmjs.org/package/rescript"><img src="https://img.shields.io/npm/v/rescript?color=brightgreen&label=npm%20package" alt="Current npm package version." /></a>
<a href="https://github.com/rescript-lang/rescript/actions"><img src="https://github.com//rescript-lang/rescript/workflows/CI/badge.svg" alt="Current Github Actions workflow status." /></a>
<a href="https://github.com/rescript-lang/rescript/blob/HEAD/LICENSE"><img src="https://img.shields.io/badge/License-LGPL%20v3-blue.svg" alt="ReScript is released under the LGPL license." /></a>
<a href="https://github.com/rescript-lang/rescript/blob/HEAD/LICENSE"><img src="https://img.shields.io/badge/License-LGPL%20%2B%20MIT-blue.svg" alt="ReScript uses both LGPL and MIT licenses." /></a>
<a href="https://x.com/intent/follow?screen_name=rescriptlang"><img src="https://img.shields.io/badge/X-000000?style=flat&logo=x&logoColor=white" alt="Follow @rescriptlang on X" /></a>
<a href="https://bsky.app/profile/rescript-lang.org"><img src="https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff&style=flat" alt="Follow @rescriptlang on Bluesky" /></a>
</p>
Expand Down Expand Up @@ -92,9 +92,14 @@ For discussions on ongoing development, see the [Development](https://forum.resc

## 📄 License

ReScript is licensed under LGPL version 3, with relaxed rules about creating and distributing combined work. See the [LICENSE](LICENSE) file for details.
ReScript uses multiple licenses in this monorepo:

The ReScript parser (subdirectory `compiler/syntax`) is licensed under the [MIT License](compiler/syntax/LICENSE).
- `compiler/`: LGPL-3.0-or-later
- `compiler/syntax/`: MIT
- `packages/@rescript/runtime/`: MIT
- `rewatch/`: MIT

See the repository license index in [`LICENSE`](LICENSE) and full license texts in [`COPYING.LESSER`](COPYING.LESSER) and [`LICENSE.MIT`](LICENSE.MIT).

The `ninja` subdirectory contains the vendored [ninja](https://github.com/ninja-build/ninja) build system.
Refer to its copyright and license notices for information about its licensing.
Expand Down
2 changes: 1 addition & 1 deletion compiler/common/bs_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
* 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 = "12.2.0-rc.1"
let version = "12.2.0"
let header = "// Generated by ReScript, PLEASE EDIT WITH CARE"
35 changes: 34 additions & 1 deletion compiler/core/lam_compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,25 @@ let compile output_prefix =
let not_typeof_clauses, typeof_clauses =
List.partition clause_is_not_typeof clauses
in
let has_object_typeof =
List.exists
(function
| Ast_untagged_variants.Untagged ObjectType, _ -> true
| _ -> false)
typeof_clauses
in
let has_array_case =
List.exists
(function
| Ast_untagged_variants.Untagged (InstanceType Array), _ -> true
| _ -> false)
not_typeof_clauses
in
(* When there's an ObjectType typeof case, null and arrays can
incorrectly match it (typeof null === typeof [] === "object").
Guard against them when they should fall through to default. *)
let needs_null_guard = has_object_typeof && has_null_case in
let needs_array_guard = has_object_typeof && not has_array_case in
let rec build_if_chain remaining_clauses =
match remaining_clauses with
| ( Ast_untagged_variants.Untagged (InstanceType instance_type),
Expand All @@ -827,7 +846,21 @@ let compile output_prefix =
(E.emit_check (IsInstanceOf (instance_type, Expr e)))
switch_body
~else_:[build_if_chain rest]
| _ -> S.string_switch ?default ?declaration (E.typeof e) typeof_clauses
| _ -> (
let typeof_switch () =
S.string_switch ?default ?declaration (E.typeof e) typeof_clauses
in
let guard =
match (needs_null_guard, needs_array_guard) with
| true, true -> Some (E.or_ (E.is_null e) (E.is_array e))
| true, false -> Some (E.is_null e)
| false, true -> Some (E.is_array e)
| false, false -> None
in
match (guard, default) with
| Some guard, Some default_body ->
S.if_ guard default_body ~else_:[typeof_switch ()]
| _ -> typeof_switch ())
in
build_if_chain not_typeof_clauses
in
Expand Down
2 changes: 1 addition & 1 deletion compiler/ml/parmatch.ml
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ let extract_fields omegas arg =

let all_record_args lbls =
match lbls with
| [] -> []
| (_, {lbl_all}, _, opt) :: _ ->
let t =
Array.map
Expand Down Expand Up @@ -560,7 +561,6 @@ let all_record_args lbls =
t.(lbl.lbl_pos) <- x)
lbls;
Array.to_list t
| _ -> fatal_error "Parmatch.all_record_args"

(* Build argument list when p2 >= p1, where p1 is a simple pattern *)
let rec simple_match_args p1 p2 =
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rescript",
"version": "12.2.0-rc.1",
"version": "12.2.0",
"description": "ReScript toolchain",
"type": "module",
"keywords": [
Expand All @@ -10,7 +10,7 @@
"JavaScript",
"Language"
],
"license": "SEE LICENSE IN LICENSE",
"license": "(LGPL-3.0-or-later AND MIT)",
"homepage": "https://rescript-lang.org",
"bugs": "https://github.com/rescript-lang/rescript/issues",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@rescript/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@rescript/darwin-arm64",
"version": "12.2.0-rc.1",
"version": "12.2.0",
"description": "ReScript binaries for MacOS ARM64",
"type": "module",
"license": "(LGPL-3.0-or-later AND MIT)",
"homepage": "https://rescript-lang.org",
"bugs": "https://github.com/rescript-lang/rescript/issues",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@rescript/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@rescript/darwin-x64",
"version": "12.2.0-rc.1",
"version": "12.2.0",
"description": "ReScript binaries for MacOS x86_64",
"type": "module",
"license": "(LGPL-3.0-or-later AND MIT)",
"homepage": "https://rescript-lang.org",
"bugs": "https://github.com/rescript-lang/rescript/issues",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@rescript/linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@rescript/linux-arm64",
"version": "12.2.0-rc.1",
"version": "12.2.0",
"description": "ReScript binaries for Linux ARM64",
"type": "module",
"license": "(LGPL-3.0-or-later AND MIT)",
"homepage": "https://rescript-lang.org",
"bugs": "https://github.com/rescript-lang/rescript/issues",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion packages/@rescript/linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@rescript/linux-x64",
"version": "12.2.0-rc.1",
"version": "12.2.0",
"description": "ReScript binaries for Linux x86_64",
"type": "module",
"license": "(LGPL-3.0-or-later AND MIT)",
"homepage": "https://rescript-lang.org",
"bugs": "https://github.com/rescript-lang/rescript/issues",
"repository": {
Expand Down
24 changes: 3 additions & 21 deletions packages/@rescript/runtime/Belt.res
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
/* Copyright (C) 2015-2016 Bloomberg Finance L.P.
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* 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. */
* SPDX-License-Identifier: MIT
*/

/*** The ReScript standard library.

Expand Down
17 changes: 5 additions & 12 deletions packages/@rescript/runtime/Belt_Array.res
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
/* ********************************************************************* */
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../LICENSE. */
/* */
/* ********************************************************************* */
/* Copyright (C) 2015-2016 Bloomberg Finance L.P.
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
*
* SPDX-License-Identifier: MIT
*/

/* Array operations */
type t<'a> = array<'a>
Expand Down
18 changes: 5 additions & 13 deletions packages/@rescript/runtime/Belt_Array.resi
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
/* ********************************************************************* */
/* */
/* OCaml */
/* */
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
/* */
/* Copyright 1996 Institut National de Recherche en Informatique et */
/* en Automatique. All rights reserved. This file is distributed */
/* under the terms of the GNU Library General Public License, with */
/* the special exception on linking described in file ../LICENSE. */
/* */
/* ********************************************************************* */
/* Adapted significantly by Authors of ReScript */
/* Copyright (C) 2015-2016 Bloomberg Finance L.P.
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
*
* SPDX-License-Identifier: MIT
*/

/***
Utilities for `Array` functions.
Expand Down
26 changes: 4 additions & 22 deletions packages/@rescript/runtime/Belt_Float.res
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
/* Copyright (C) 2017 Hongbo Zhang, Authors of ReScript
/* Copyright (C) 2015-2016 Bloomberg Finance L.P.
* Copyright (C) 2017- Hongbo Zhang, Authors of ReScript
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition to the permissions granted to you by the LGPL, you may combine
* or link a "work that uses the Library" with a publicly distributed version
* of this file to produce a combined library or application, then distribute
* that combined work under the terms of your choosing, with no requirement
* to comply with the obligations normally placed on you by section 4 of the
* LGPL version 3 (or the corresponding section of a later version of the LGPL
* should you choose to use a later version).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* 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. */
* SPDX-License-Identifier: MIT
*/

/*** [`Belt.Float`]()
Utilities for Float
Expand Down
Loading
Loading