Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions compiler/core/lam_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ let refine_let
since function evaluation is always delayed
*)
Lam.let_ Alias param arg l
| (Strict | StrictOpt),
( Lprim {primitive = Psome_not_nest; _} as prim ), _ ->
Lam.let_ Alias param prim l
| ( (Strict | StrictOpt ) ), (Lfunction _ ), _ ->
(*It can be promoted to [Alias], however,
we don't want to do this, since we don't want the
Expand Down
6 changes: 2 additions & 4 deletions packages/@rescript/runtime/lib/es6/Belt_internalAVLset.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,13 @@ function rotateWithRightChild(k1) {

function doubleWithLeftChild(k3) {
let k3l = k3.l;
let v = rotateWithRightChild(k3l);
k3.l = v;
k3.l = rotateWithRightChild(k3l);
return rotateWithLeftChild(k3);
}

function doubleWithRightChild(k2) {
let k2r = k2.r;
let v = rotateWithLeftChild(k2r);
k2.r = v;
k2.r = rotateWithLeftChild(k2r);
return rotateWithRightChild(k2);
}

Expand Down
6 changes: 2 additions & 4 deletions packages/@rescript/runtime/lib/js/Belt_internalAVLset.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,15 +741,13 @@ function rotateWithRightChild(k1) {

function doubleWithLeftChild(k3) {
let k3l = k3.l;
let v = rotateWithRightChild(k3l);
k3.l = v;
k3.l = rotateWithRightChild(k3l);
return rotateWithLeftChild(k3);
}

function doubleWithRightChild(k2) {
let k2r = k2.r;
let v = rotateWithLeftChild(k2r);
k2.r = v;
k2.r = rotateWithLeftChild(k2r);
return rotateWithRightChild(k2);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions tests/tests/src/option_optimisation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";

function boolean(val1, val2) {
let a = val1;
let b = val2;
if (b || a) {
if (val2 || val1) {
return "a";
} else {
return "b";
Expand Down Expand Up @@ -33,8 +31,7 @@ function constant() {
}

function param(opt) {
let x = opt;
console.log(x);
console.log(opt);
}

export {
Expand Down
52 changes: 26 additions & 26 deletions tests/tests/src/option_wrapping_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ let x6 = {
x: 42
};

let x10 = null;

let x11 = Primitive_option.some(undefined);

let x1 = "hello";

let x2 = 1;

let x3 = {
TAG: "Ok",
_0: "hi"
};

let x4 = "polyvar";

let x5 = {
x: 42
};

let x7 = [
1,
2,
Expand All @@ -16,9 +35,7 @@ let x7 = [

let x8 = () => {};

let x10 = null;

let x11 = Primitive_option.some(undefined);
let x12 = "test";

let x20 = null;

Expand Down Expand Up @@ -68,36 +85,19 @@ let x42 = new Intl.PluralRules();

let x43 = new Intl.Locale("en");

let x45 = Promise.resolve(true);

let x47 = {};

let x48 = Stdlib_Lazy.make(() => true);

let x1 = "hello";

let x2 = 1;

let x3 = {
TAG: "Ok",
_0: "hi"
};

let x4 = "polyvar";

let x5 = {
x: 42
};

let x12 = "test";

let x44 = [
1,
2
];

let x45 = Promise.resolve(true);

let x46 = /* [] */0;

let x47 = {};

let x48 = Stdlib_Lazy.make(() => true);

export {
x1,
x2,
Expand Down
23 changes: 11 additions & 12 deletions tests/tests/src/reasonReact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@ function wrapReasonForJs(component, jsPropsToReason) {
let dummyInteropComponent = basicComponent("interop");

function wrapJsForReason(reactClass, props, children) {
let jsElementWrapped = (extra, extra$1) => {
let props$1 = Object.assign(Object.assign({}, props), {
ref: extra$1,
key: extra
});
let varargs = Js_array.concat(children, [
reactClass,
props$1
]);
return React.createElement.apply(null, varargs);
};
return {
debugName: dummyInteropComponent.debugName,
reactClassInternal: dummyInteropComponent.reactClassInternal,
Expand All @@ -117,7 +106,17 @@ function wrapJsForReason(reactClass, props, children) {
initialState: dummyInteropComponent.initialState,
retainedProps: dummyInteropComponent.retainedProps,
reducer: dummyInteropComponent.reducer,
jsElementWrapped: jsElementWrapped
jsElementWrapped: (extra, extra$1) => {
let props$1 = Object.assign(Object.assign({}, props), {
ref: extra$1,
key: extra
});
let varargs = Js_array.concat(children, [
reactClass,
props$1
]);
return React.createElement.apply(null, varargs);
}
};
}

Expand Down
Loading