Skip to content

Use rescript@v10 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Use rescript@v10 #1

wants to merge 1 commit into from

Conversation

DZakh
Copy link
Owner

@DZakh DZakh commented Jul 5, 2022

No description provided.

Comment on lines +141 to +144
return "Invalid union with following errors" + lineBreak + "" + reasons.join(lineBreak) + "";

}
return "Expected " + reason.expected + ", received " + reason.received;
return "Expected " + reason.expected + ", received " + reason.received + "";
Copy link
Owner Author

Choose a reason for hiding this comment

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

Started adding empty strings around values in template literal.

Choose a reason for hiding this comment

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

Can't seem to repro:

// tst.res
let template = (nestedLevel, reasons, foo) => {
  let lineBreak = `\n${" "->Js.String2.repeat(nestedLevel * 2)}`
  `Invalid union with following errors${lineBreak}${reasons->Js.Array2.joinWith(lineBreak)}`
}

gives

// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';


function template(nestedLevel, reasons, foo) {
  var lineBreak = "\n" + " ".repeat((nestedLevel << 1));
  return "Invalid union with following errors" + lineBreak + reasons.join(lineBreak);
}

exports.template = template;
/* No side effect */

Would you open an issue with a self-contained repro?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I've created an issue rescript-lang/rescript#5521

}

function toString(error) {
var match = error.operation;
var operation = match ? "parsing" : "serializing";
var reason = toReason(undefined, error);
var pathText = formatPath(error.path);
return "[ReScript Struct]" + " Failed " + operation + " at " + pathText + ". Reason: " + reason;
return "[ReScript Struct] Failed " + operation + " at " + pathText + ". Reason: " + reason + "";
Copy link
Owner Author

Choose a reason for hiding this comment

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

Here it joined to string values on compile-time, that's super cool!
([ReScript Struct] and Failed)

Comment on lines 415 to +418
valueRef.contents = newValue
idxRef.contents = idxRef.contents->Lib.Int.plus(1)
}

Copy link
Owner Author

Choose a reason for hiding this comment

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

A forced new line after switch case with code block looks off to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants