Skip to content

Handle properly stringifying multiline (boolean) expressions#15709

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
Blacksmoke16:boolean-expression-string-representation
May 2, 2025
Merged

Handle properly stringifying multiline (boolean) expressions#15709
straight-shoota merged 1 commit intocrystal-lang:masterfrom
Blacksmoke16:boolean-expression-string-representation

Conversation

@Blacksmoke16
Copy link
Member

@Blacksmoke16 Blacksmoke16 commented Apr 26, 2025

Previously code like:

{%
  (
    true ||
    false
  )
%}

{%
  (
    1
  )
%}

Would always be stringified as:

{%
  (true || false)
%}

{%
  (1)
%}

With this PR it now remains unchanged.

EDIT: Force pushed to rebase on master after #15614 was merged.

Comment on lines +773 to +774
true ||
false
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be indented the same as the regular code, I guess?

Suggested change
true ||
false
true ||
false

ditto all below

Copy link
Member Author

@Blacksmoke16 Blacksmoke16 Apr 30, 2025

Choose a reason for hiding this comment

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

Dunno, formatter doesn't do anything with it in this macro context so imo it's fine as it is. The main objective was to have proper line numbers. Column numbers are less important. Esp when it's subjective what the indentation should be.

Copy link
Member

Choose a reason for hiding this comment

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

I suppose the formatter really should act on code inside macro expressions. Let's leave that for a follow-up, though.

@Blacksmoke16 Blacksmoke16 force-pushed the boolean-expression-string-representation branch from 29afd9b to 024a04d Compare April 30, 2025 03:56
@straight-shoota straight-shoota added this to the 1.17.0 milestone Apr 30, 2025
@Blacksmoke16 Blacksmoke16 mentioned this pull request May 2, 2025
2 tasks
@straight-shoota straight-shoota merged commit 4ef0a04 into crystal-lang:master May 2, 2025
34 of 36 checks passed
@Blacksmoke16 Blacksmoke16 deleted the boolean-expression-string-representation branch May 2, 2025 15:21
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.

3 participants