-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add space between multiple strings while printing #2670
base: main
Are you sure you want to change the base?
Add space between multiple strings while printing #2670
Conversation
@Shaikh-Ubaid could you please rerun the CI? The failing check is unrelated to the PR. |
The approach in this PR might break % cat examples/expr2.f90
program expr2
implicit none
print *, "hi", "bye"
print *, 12, 23
end program
% gfortran examples/expr2.f90
% ./a.out
hibye
12 23
% lfortran examples/expr2.f90
hibye
12 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shaikh-Ubaid thanks for this! I will try to create a solution that works for both. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
6fc0b6a
Compare
fixes #2669