Conversation

aspeddro

rescript-lang/syntax#168

TODO:

  • update CHANGELOG

@cristianoc

Quick check before even reading the code: this still parses the old style and converts to the new style, correct?

@aspeddro

No, old style is a syntax error.

@cristianoc

That's a breaking change.
Should accept it and convert it on format.

@aspeddro

We can convert to the new format, but it changes the precedence.

// Before
assert 1 == 2
// Parsed as
(assert 1) == 2

// Now
assert(1 == 2)

Currently assert is an unary expression.

@cristianoc

I think that OK. It's going to matter in very few cases.

@cristianoc

Still: to be mentioned in release notes.

@cristianoc

Are there tests that show that old style assert is still parsed? E.g. assert false without parens.

| Nothing -> doc
let doc = printExpressionWithComments ~state expr cmtTbl in
let expr =
match expr.pexp_desc with
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure I understand why this code is required.
Seems oddly specific for a generic assert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in ef6501e. It is in fact no longer necessary.

Choose a reason for hiding this comment

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

Looking great!
Ready to merge?

@aspeddro

👍🏾

@cristianoccristianoc merged commit ec6ae34 into rescript-lang:master Apr 20, 2023
@DZakh

It's the first time a hear about assert. Also, I haven't found it in the docs (besides the reserved keywords section). I wonder whether it should be removed from the compiler entirely and come to the userland.

@cristianoc

It's the first time a hear about assert. Also, I haven't found it in the docs (besides the reserved keywords section). I wonder whether it should be removed from the compiler entirely and come to the userland.

The thing is avoiding breaking changes.
This is a small thing but by experience a couple of small things are enough to delay people upgrading compiler version.

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

Successfully merging this pull request may close these issues.