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.

makenowjust added 2 commits Jul 13, 2017
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

@bararchy bararchy commented Jul 31, 2017

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

RX14
RX14 approved these changes Jul 31, 2017
@ysbaddaden ysbaddaden merged commit 8f2f505 into crystal-lang:master Aug 1, 2017
2 checks passed
@RX14 RX14 added this to the Next milestone Aug 1, 2017
@makenowjust makenowjust deleted the fix/crystal/4663-chained-comparisons-to-s branch Aug 1, 2017
straight-shoota pushed a commit to straight-shoota/crystal that referenced this issue 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 issue 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 issue 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