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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Add popover attributes to JsxDOM.domProps. https://github.com/rescript-lang/rescript/pull/7317
- Add `inert` attribute to `JsxDOM.domProps`. https://github.com/rescript-lang/rescript/pull/7326
- Make reanalyze exception tracking work with the new stdlib. https://github.com/rescript-lang/rescript/pull/7328
- Fix Pervasive.max using boolean comparison for floats. https://github.com/rescript-lang/rescript/pull/7333

#### :boom: Breaking Change

Expand Down
22 changes: 11 additions & 11 deletions compiler/ml/translcore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let comparisons_table =
objcomp = Pobjmax;
intcomp = Pintmax;
boolcomp = Pboolmax;
floatcomp = Pboolmax;
floatcomp = Pfloatmax;
stringcomp = Pstringmax;
bigintcomp = Pbigintmax;
simplify_constant_constructor = false;
Expand Down Expand Up @@ -211,16 +211,6 @@ let comparisons_table =
} );
(* FIXME: Core compatibility *)
( "%bs_min",
{
objcomp = Pobjmax;
intcomp = Pintmax;
boolcomp = Pboolmax;
floatcomp = Pboolmax;
stringcomp = Pstringmax;
bigintcomp = Pbigintmax;
simplify_constant_constructor = false;
} );
( "%bs_max",
{
objcomp = Pobjmin;
intcomp = Pintmin;
Expand All @@ -230,6 +220,16 @@ let comparisons_table =
bigintcomp = Pbigintmin;
simplify_constant_constructor = false;
} );
( "%bs_max",
{
objcomp = Pobjmax;
intcomp = Pintmax;
boolcomp = Pboolmax;
floatcomp = Pfloatmax;
stringcomp = Pstringmax;
bigintcomp = Pbigintmax;
simplify_constant_constructor = false;
} );
|]

let primitives_table =
Expand Down
2 changes: 1 addition & 1 deletion lib/es6/Stdlib_List.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ function reduceReverse2(l1, l2, acc, f) {
let a = toArray(l1);
let b = toArray(l2);
let r = acc;
let len$1 = Primitive_int.max(a.length, b.length);
let len$1 = Primitive_int.min(a.length, b.length);
for (let i = len$1 - 1 | 0; i >= 0; --i) {
r = f(r, a[i], b[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/js/Stdlib_List.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ function reduceReverse2(l1, l2, acc, f) {
let a = toArray(l1);
let b = toArray(l2);
let r = acc;
let len$1 = Primitive_int.max(a.length, b.length);
let len$1 = Primitive_int.min(a.length, b.length);
for (let i = len$1 - 1 | 0; i >= 0; --i) {
r = f(r, a[i], b[i]);
}
Expand Down
5 changes: 2 additions & 3 deletions tests/tests/src/mario_game.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import * as Belt_List from "rescript/lib/es6/Belt_List.js";
import * as Pervasives from "rescript/lib/es6/Pervasives.js";
import * as Primitive_int from "rescript/lib/es6/Primitive_int.js";
import * as Primitive_bool from "rescript/lib/es6/Primitive_bool.js";
import * as Primitive_float from "rescript/lib/es6/Primitive_float.js";
import * as Primitive_object from "rescript/lib/es6/Primitive_object.js";
import * as Primitive_option from "rescript/lib/es6/Primitive_option.js";
Expand Down Expand Up @@ -979,7 +978,7 @@ function update_player(player, keys, context) {
if (!player.jumping && player.grounded) {
player.jumping = true;
player.grounded = false;
player.vel.y = Primitive_bool.max(player.vel.y - (5.7 + Math.abs(player.vel.x) * 0.25), -6);
player.vel.y = Primitive_float.max(player.vel.y - (5.7 + Math.abs(player.vel.x) * 0.25), -6);
return;
} else {
return;
Expand Down Expand Up @@ -1531,7 +1530,7 @@ function make$3(param, param$1) {

function calc_viewport_point(cc, vc, mc) {
let vc_half = vc / 2;
return Primitive_float.min(Primitive_bool.max(cc - vc_half, 0), Primitive_float.min(mc - vc, Math.abs(cc - vc_half)));
return Primitive_float.min(Primitive_float.max(cc - vc_half, 0), Primitive_float.min(mc - vc, Math.abs(cc - vc_half)));
}

function in_viewport(v, pos) {
Expand Down