Skip to content

Commit b69c78c

Browse files
committed
Remove redundant braces in foreach parameter diagnostic loop
Addresses review comment from @thewilsonator on #23780.
1 parent 5a52fcb commit b69c78c

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

compiler/src/dmd/opover.d

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,15 +1614,13 @@ void explainForeachArgMismatch(FuncDeclaration fstart, Parameters* parameters, M
16141614
Parameter param = tdg.parameterList[u];
16151615
if (p.type.equals(param.type))
16161616
continue;
1617+
if (!headerPrinted)
16171618
{
1618-
if (!headerPrinted)
1619-
{
1620-
eSink.errorSupplemental(f.loc, "`%s`:", tf.toChars());
1621-
headerPrinted = true;
1622-
}
1623-
eSink.errorSupplemental(f.loc, " parameter %llu: `foreach` declares `%s`, expected `%s`",
1624-
cast(ulong)(u + 1), p.type.toErrMsg(), param.type.toErrMsg());
1619+
eSink.errorSupplemental(f.loc, "`%s`:", tf.toChars());
1620+
headerPrinted = true;
16251621
}
1622+
eSink.errorSupplemental(f.loc, " parameter %llu: `foreach` declares `%s`, expected `%s`",
1623+
cast(ulong)(u + 1), p.type.toErrMsg(), param.type.toErrMsg());
16261624
}
16271625
return 0;
16281626
});

0 commit comments

Comments
 (0)