You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I learned that the implementations allow a trailing comma in for loop updater clauses:
voidmain() {
for (int i; i <10; print("foo"), ++i, print("bar"),) {
break;
}
}
The current formatter preserves the trailing comma (yay!) but doesn't force the clauses to split like trailing commas do elsewhere. That's probably not worth fixing since we're working on the new style.
I don't know what the new formatter does with this. I think what it should do is just discard the trailing comma, whether the updaters split or not. (The other option would be to have it drop the trailing comma if the for loop parts don't split and add them if they do, but I don't think that's what users would want. When the for loop parts split, it's rarely because there are multiple updaters and usually because the clauses themselves don't all fit. In that case, I think users would be unpleasantly surprised to see a trailing comma appear after the last [and likely only] updater.)
The text was updated successfully, but these errors were encountered:
Whatever the new formatter does here, I'll need to be careful to ensure that any comments before or after the trailing comma don't get lost if the comma is discarded.
Today I learned that the implementations allow a trailing comma in for loop updater clauses:
The current formatter preserves the trailing comma (yay!) but doesn't force the clauses to split like trailing commas do elsewhere. That's probably not worth fixing since we're working on the new style.
I don't know what the new formatter does with this. I think what it should do is just discard the trailing comma, whether the updaters split or not. (The other option would be to have it drop the trailing comma if the for loop parts don't split and add them if they do, but I don't think that's what users would want. When the for loop parts split, it's rarely because there are multiple updaters and usually because the clauses themselves don't all fit. In that case, I think users would be unpleasantly surprised to see a trailing comma appear after the last [and likely only] updater.)
The text was updated successfully, but these errors were encountered: