-
Notifications
You must be signed in to change notification settings - Fork 47
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
Anonymous class as function parameter messes up entirely #545
Comments
What is actually the expected brace style? Since this is continues a statement across lines it could arguably be indented one deeper: void main()
{
call(new class Object
{
void method()
{
call;
}
}
);
} The one suggested is commonly used across languages and it seems reasonable to use. Also consider this: void f()
{
// Should it be this (case 1):
writeln("Anonymous object does not begin on the first line",
new class Object
{
void method()
{
writeln;
}
});
// Or this (case 2):
writeln("Anonymous object does not begin on the first line",
new class Object
{
void method()
{
writeln;
}
});
// Or this (case 3):
writeln("Anonymous object does not begin on the first line",
new class Object
{
void method()
{
writeln;
}
}
);
} I think case 2 since I don't think having closing parentheses on the same indent level as opening is reasonable (case 3); case 1 seems to me like an obvious no. I think the behaviour should be consistent with braces in parenthesis in general, which is currently: void g()
{
// Current behaviour brace on first line:
writeln({
int longVarNameToForceLineBreak = 5;
writeln(longVarNameToForceLineBreak);
return longVarNameToForceLineBreak * 2;
});
// Current behaviour brace not on first line (brace case 1):
writeln("Brace does not begin on the first line",
{
int longVarNameToForceLineBreak = 5;
writeln(longVarNameToForceLineBreak);
return longVarNameToForceLineBreak * 2;
});
// Current behaviour brace not on first line (brace case 2):
writeln("Brace does not begin on the first line",
{
int longVarNameToForceLineBreak = 5;
writeln(longVarNameToForceLineBreak);
return longVarNameToForceLineBreak * 2;
});
} |
I agree, case 2 seems good and in general keeping consistency with existing parentheses rules |
Consider:
dfmt's take:
And from there on, the entire rest of the file is misindented by one.
The text was updated successfully, but these errors were encountered: