Skip to content
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

Fix chained comparisons to_s to work #4663 #4708

Conversation

makenowjust
Copy link
Contributor

@makenowjust makenowjust commented Jul 13, 2017

Fixed #4663

The ASTNode of 1 <= 2 <= 3 is to_s-ed to (1 <= 2) <= 3. Right side parenthesis is not required and it causes #4653 error.

The ASTNode of `1 <= 2 <= 3` is `to_s`-ed to `(1 <= 2) <= 3`.
Right side parenthesis is not required and it causes crystal-lang#4653 error.
@bararchy
Copy link
Contributor

Is this getting looked at? @RX14 or @matiasgarciaisaia :)

@ysbaddaden ysbaddaden merged commit 8f2f505 into crystal-lang:master Aug 1, 2017
@RX14 RX14 added this to the Next milestone Aug 1, 2017
@makenowjust makenowjust deleted the fix/crystal/4663-chained-comparisons-to-s branch August 1, 2017 12:57
straight-shoota pushed a commit to straight-shoota/crystal that referenced this pull request Aug 11, 2017
…g#4708)

Fix to work crystal-lang#4663

The ASTNode of `1 <= 2 <= 3` is `to_s`-ed to `(1 <= 2) <= 3`.
Right side parenthesis is not required and it causes crystal-lang#4653 error.
Val pushed a commit to Val/crystal that referenced this pull request Aug 12, 2017
…g#4708)

Fix to work crystal-lang#4663

The ASTNode of `1 <= 2 <= 3` is `to_s`-ed to `(1 <= 2) <= 3`.
Right side parenthesis is not required and it causes crystal-lang#4653 error.
makenowjust added a commit to makenowjust/crystal that referenced this pull request Aug 19, 2017
This fixes `ToSVisitor` uses parent node information to decide to wrap receiver with parens (so we can detect chained comparison correctly!)
`to_s` with `1 <= 2 <= 3` AST yields itself, and now `to_s` with `(1 <= 2).as(Bool)` AST yields itself too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants