Uh oh!
There was an error while loading. Please reload this page.
Add space between multiple strings while printing - #2670
Conversation
kmr-srbh
commented
Apr 26, 2024
@Shaikh-Ubaid could you please rerun the CI? The failing check is unrelated to the PR. |
ubaidsk
commented
Apr 26, 2024
The approach in this PR might break % cat examples/expr2.f90 program expr2implicit noneprint *, "hi", "bye"print *, 12, 23end program
% gfortran examples/expr2.f90
% ./a.out hibye 12 23
% lfortran examples/expr2.f90hibye12 23 |
| if (global_sep_space && | ||
| !(ASRUtils::is_character(*ASRUtils::expr_type(x.m_values[i])) | ||
| && ASRUtils::is_character(*ASRUtils::expr_type(x.m_values[i - 1])))) { | ||
| if (global_sep_space) { |
There was a problem hiding this comment.
The way to fix this such that we print spaces when two consecutive arguments are strings in LPython and not print spaces for the same in LFortran, is to support this in AST->ASR Translation.
There was a problem hiding this comment.
You will need to figure out how to update the middle-ends of both lfortran and lpython such that both of them work as expected when two consecutive arguments are strings.
There was a problem hiding this comment.
@Shaikh-Ubaid thanks for this! I will try to create a solution that works for both. 👍
There was a problem hiding this comment.
See if your solution works for both lpython and lfortran (test it locally on your system or send a PR to lfortran so it gets tested at the CI). If no run reference tests change for lfortran, then it works.
You can also test your current approach with lfortran. If it works currently, then I think its good.
c52e653 to
6fc0b6aCompare
fixes#2669