Skip to content

Use rescript@v10 - #1

Closed
DZakh wants to merge 1 commit into
mainfrom
rescript-next
Closed

DZakh wants to merge 1 commit into
mainfrom
rescript-next

Conversation

@DZakh

@DZakh DZakh commented Jul 5, 2022

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/S.bs.js
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
Copy Markdown
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.

Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread src/S.bs.js
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
Copy Markdown
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 thread src/S.res
Comment on lines 415 to +418
valueRef.contents = newValue
idxRef.contents = idxRef.contents->Lib.Int.plus(1)
}

Copy link
Copy Markdown
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