Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
String interpolation: combine contiguous string literals #8581
I think this should go in 0.32.1 because this was an accidental breaking change.
The fix is done at normalization because doing it before breaks the formatter a bit (mainly around string literals that aren't actually string literals, like
The heredoc in issue #8576 seem to have just 1 interpolation inside and many more lines. The use-case was real, a code generation in https://github.com/cubos/sdkgen/blob/master/src/target/java_android.cr
I think it's a rare use-case, but I imagine in some cases having a long source inside heredoc with some interpolations inside would look nicer that splitting generated source into multiple heredocs.
So if there is a 1000 lines long text inside heredoc and a couple of interpolations inside, will it work now with this fix?
If I remember correctly the parser will spit out lines because then it needs to realign each of them according to the heredocs indentation. I tried to fix it in the parser, it broke the formatter and so I made the fix later on.
In any case, once this is merged I will maybe send another PR in which constants that refer to strings and appear in string interpolations will be inlined right away, so contiguous merging will still be needed.