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 @@ -15,6 +15,7 @@

#### :bug: Bug fix
- Fix bug where a ref assignment is moved ouside a conditional. https://github.com/rescript-lang/rescript/pull/7176
- Fix nullable to opt conversion. https://github.com/rescript-lang/rescript/pull/7193

#### :house: Internal
- Use latest compiler for tests. https://github.com/rescript-lang/rescript/pull/7186
Expand Down
4 changes: 2 additions & 2 deletions compiler/ml/translcore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ let primitives_table =
("#undefined", Pundefined);
("#typeof", Ptypeof);
("#is_nullable", Pisnullable);
("#null_to_opt", Pnullable_to_opt);
("#nullable_to_opt", Pnull_to_opt);
("#null_to_opt", Pnull_to_opt);
("#nullable_to_opt", Pnullable_to_opt);
("#undefined_to_opt", Pundefined_to_opt);
("#makemutablelist", Pmakelist Mutable);
("#import", Pimport);
Expand Down
32 changes: 16 additions & 16 deletions lib/es6/Null.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ function fromOption(option) {
}

function equal(a, b, eq) {
return Option.equal((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), eq);
return Option.equal(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), eq);
}

function compare(a, b, cmp) {
return Option.compare((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), cmp);
return Option.compare(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), cmp);
}

function getOr(value, $$default) {
if (value == null) {
return $$default;
} else {
if (value !== null) {
return value;
} else {
return $$default;
}
}

function getExn(value) {
if (!(value == null)) {
if (value !== null) {
return value;
}
throw {
Expand All @@ -39,33 +39,33 @@ function getExn(value) {
}

function forEach(value, f) {
if (!(value == null)) {
if (value !== null) {
return f(value);
}

}

function map(value, f) {
if (value == null) {
return null;
} else {
if (value !== null) {
return f(value);
} else {
return null;
}
}

function mapOr(value, $$default, f) {
if (value == null) {
return $$default;
} else {
if (value !== null) {
return f(value);
} else {
return $$default;
}
}

function flatMap(value, f) {
if (value == null) {
return null;
} else {
if (value !== null) {
return f(value);
} else {
return null;
}
}

Expand Down
32 changes: 16 additions & 16 deletions lib/es6/Nullable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ function fromOption(option) {
}

function equal(a, b, eq) {
return Option.equal(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), eq);
return Option.equal((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), eq);
}

function compare(a, b, cmp) {
return Option.compare(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), cmp);
return Option.compare((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), cmp);
}

function getOr(value, $$default) {
if (value !== null) {
return value;
} else {
if (value == null) {
return $$default;
} else {
return value;
}
}

function getExn(value) {
if (value !== null) {
if (!(value == null)) {
return value;
}
throw {
Expand All @@ -38,33 +38,33 @@ function getExn(value) {
}

function forEach(value, f) {
if (value !== null) {
if (!(value == null)) {
return f(value);
}

}

function map(value, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return value;
} else {
return f(value);
}
}

function mapOr(value, $$default, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return $$default;
} else {
return f(value);
}
}

function flatMap(value, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return value;
} else {
return f(value);
}
}

Expand Down
32 changes: 16 additions & 16 deletions lib/js/Null.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ function fromOption(option) {
}

function equal(a, b, eq) {
return Option.equal((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), eq);
return Option.equal(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), eq);
}

function compare(a, b, cmp) {
return Option.compare((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), cmp);
return Option.compare(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), cmp);
}

function getOr(value, $$default) {
if (value == null) {
return $$default;
} else {
if (value !== null) {
return value;
} else {
return $$default;
}
}

function getExn(value) {
if (!(value == null)) {
if (value !== null) {
return value;
}
throw {
Expand All @@ -39,33 +39,33 @@ function getExn(value) {
}

function forEach(value, f) {
if (!(value == null)) {
if (value !== null) {
return f(value);
}

}

function map(value, f) {
if (value == null) {
return null;
} else {
if (value !== null) {
return f(value);
} else {
return null;
}
}

function mapOr(value, $$default, f) {
if (value == null) {
return $$default;
} else {
if (value !== null) {
return f(value);
} else {
return $$default;
}
}

function flatMap(value, f) {
if (value == null) {
return null;
} else {
if (value !== null) {
return f(value);
} else {
return null;
}
}

Expand Down
32 changes: 16 additions & 16 deletions lib/js/Nullable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ function fromOption(option) {
}

function equal(a, b, eq) {
return Option.equal(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), eq);
return Option.equal((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), eq);
}

function compare(a, b, cmp) {
return Option.compare(a === null ? undefined : Primitive_option.some(a), b === null ? undefined : Primitive_option.some(b), cmp);
return Option.compare((a == null) ? undefined : Primitive_option.some(a), (b == null) ? undefined : Primitive_option.some(b), cmp);
}

function getOr(value, $$default) {
if (value !== null) {
return value;
} else {
if (value == null) {
return $$default;
} else {
return value;
}
}

function getExn(value) {
if (value !== null) {
if (!(value == null)) {
return value;
}
throw {
Expand All @@ -38,33 +38,33 @@ function getExn(value) {
}

function forEach(value, f) {
if (value !== null) {
if (!(value == null)) {
return f(value);
}

}

function map(value, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return value;
} else {
return f(value);
}
}

function mapOr(value, $$default, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return $$default;
} else {
return f(value);
}
}

function flatMap(value, f) {
if (value !== null) {
return f(value);
} else {
if (value == null) {
return value;
} else {
return f(value);
}
}

Expand Down
Loading