Skip to content

Commit 6deaffb

Browse files
committed
Merge branch 'fmtarg' into 'master'
fmt: Print dummy arguments correctly See merge request lfortran/lfortran!636
2 parents 1f906d6 + 94bb342 commit 6deaffb

File tree

7 files changed

+41
-1
lines changed

7 files changed

+41
-1
lines changed

src/lfortran/ast_to_src.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ class ASTToSRCVisitor : public BaseVisitor<ASTToSRCVisitor>
762762
for (size_t i=0; i<x.n_args; i++) {
763763
this->visit_expr(*x.m_args[i]);
764764
r.append(s);
765-
if (i < x.n_args-1) s.append(", ");
765+
if (i < x.n_args-1) r.append(", ");
766766
}
767767
for (size_t i=0; i<x.n_keywords; i++) {
768768
this->visit_keyword(x.m_keywords[i]);

tests/fn_call1.f90

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
size(tvec, dim=2)
2+
min(tvec(2, i), tvec(1, i))
3+
a(1, 2, 3)
4+
A(i,j,k)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "ast-fn_call1-7e6ba0b",
3+
"cmd": "lfortran --show-ast --no-color {infile} -o {outfile}",
4+
"infile": "tests/fn_call1.f90",
5+
"infile_hash": "734b71292f6dc8ea73b211bbddc7438c34a8a3bd72ccbffa35f19e0e",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "ast-fn_call1-7e6ba0b.stdout",
9+
"stdout_hash": "f40788d7b1682acb151b97bff70b111b05328996514bd6f599e8af19",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(TranslationUnit [(FuncCallOrArray size [tvec 2] []) (FuncCallOrArray min [(FuncCallOrArray tvec [2 i] []) (FuncCallOrArray tvec [1 i] [])] []) (FuncCallOrArray a [1 2 3] []) (FuncCallOrArray A [i j k] [])])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "ast_f90-fn_call1-e65b119",
3+
"cmd": "lfortran --show-ast-f90 --no-color {infile}",
4+
"infile": "tests/fn_call1.f90",
5+
"infile_hash": "734b71292f6dc8ea73b211bbddc7438c34a8a3bd72ccbffa35f19e0e",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": "ast_f90-fn_call1-e65b119.stdout",
9+
"stdout_hash": "57464594a9c140984450d6a8f2864ab9e061bd798be860666065610b",
10+
"stderr": null,
11+
"stderr_hash": null,
12+
"returncode": 0
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
size(tvec, 2)
2+
min(tvec(2, i), tvec(1, i))
3+
a(1, 2, 3)
4+
A(i, j, k)

tests/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,3 +571,8 @@ mod_to_asr = true
571571
filename = "fmt1.f90"
572572
ast = true
573573
ast_f90 = true
574+
575+
[[test]]
576+
filename = "fn_call1.f90"
577+
ast = true
578+
ast_f90 = true

0 commit comments

Comments
 (0)