Skip to content

Commit

Permalink
ReScript 12 compatibility workaround (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt authored Sep 26, 2024
1 parent 6fe25ef commit 019cbce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/S_Core.bs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,10 @@ function reason(error, nestedLevelOpt) {
}
}

function reason$1(error) {
return reason(error, undefined);
}

function message(error) {
var match = error.operation;
var operation;
Expand All @@ -2379,7 +2383,7 @@ function message(error) {
}
var nonEmptyPath = error.path;
var pathText = nonEmptyPath === "" ? "root" : nonEmptyPath;
return "Failed " + operation + " at " + pathText + ". Reason: " + reason(error);
return "Failed " + operation + " at " + pathText + ". Reason: " + reason(error, undefined);
}

function internalInline(schema, maybeVariant, param) {
Expand Down Expand Up @@ -3087,7 +3091,7 @@ var $$Error$1 = {
make: make$1,
raise: raise$1,
message: message,
reason: reason
reason: reason$1
};

var Literal = {
Expand Down
2 changes: 1 addition & 1 deletion src/S_Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -3473,7 +3473,7 @@ module Error = {
}
}

let reason = reason->(Obj.magic: ((error, ~nestedLevel: int=?) => string) => error => string)
let reason = error => reason(error)

let message = (error: error) => {
let operation = switch error.operation {
Expand Down

1 comment on commit 019cbce

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 019cbce Previous: 90ab99c Ratio
Parse string 809708404 ops/sec (±0.14%) 811431552 ops/sec (±0.15%) 1.00
Serialize string 811144255 ops/sec (±0.09%) 812781945 ops/sec (±0.05%) 1.00
Advanced object schema factory 451653 ops/sec (±1.01%) 472293 ops/sec (±0.54%) 1.05
Parse advanced object 55603357 ops/sec (±0.58%) 56799894 ops/sec (±0.57%) 1.02
Assert advanced object - compile 163460997 ops/sec (±0.14%)
Assert advanced object 171858126 ops/sec (±0.09%) 171920805 ops/sec (±0.20%) 1.00
Create and parse advanced object 93738 ops/sec (±0.58%) 95083 ops/sec (±0.21%) 1.01
Parse advanced strict object 25072487 ops/sec (±0.41%) 25471962 ops/sec (±0.17%) 1.02
Assert advanced strict object 30147115 ops/sec (±0.47%) 30460141 ops/sec (±0.20%) 1.01
Serialize advanced object 72628123 ops/sec (±0.32%) 74797850 ops/sec (±0.32%) 1.03

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.