We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is CSharpier 0.20.0:
class X { private int? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; private int? bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; private int? ccccccccccccccccccccccccccccccccccc; static void null_coalescing_arithmetic() { var x = new X(); var result1 = x.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - x.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - x.ccccccccccccccccccccccccccccccccccc; var result2 = ( x.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - x.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - x.ccccccccccccccccccccccccccccccccccc ); var result3 = x.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - x.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - x.ccccccccccccccccccccccccccccccccccc ?? 0; var result4 = ( x.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - x.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb - x.ccccccccccccccccccccccccccccccccccc ) ?? 0; } }
result1
result2
result3
result4
result1 and result2 are semantically equivalent, as is result3 with result4.
The text was updated successfully, but these errors were encountered:
Probably related. Adding a null-coalescing operator caused this change in line breaking
var discontinuedProductIds = result.GetWishListResult.GetProductCollectionResult ?.ProductDtos?.Where(o => o.IsDiscontinued && !o.CanBackOrder) .Select(o => o.Id) .ToHashSet(); var discontinuedProductIds = result.GetWishListResult.GetProductCollectionResult ?.ProductDtos?.Where(o => o.IsDiscontinued && !o.CanBackOrder) .Select(o => o.Id) .ToHashSet() ?? new HashSet<Guid>();
Sorry, something went wrong.
Another example that I think is related: null-coalesing operator at the end of a method chain:
// Without null coalescing, looks good (0.26.3) var method = target .DeclaringType! .GetMethod(ReplaceMethod, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); // With null coalescing: additional indentation and needless breaks (0.26.3) var method = target .DeclaringType! .GetMethod( ReplaceMethod, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public ) ?? throw new($"Could not find method {ReplaceMethod} on {target.DeclaringType}"); // Preferred formatting var method = target .DeclaringType! .GetMethod(ReplaceMethod, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public) ?? throw new($"Could not find method {ReplaceMethod} on {target.DeclaringType}");
No branches or pull requests
This is CSharpier 0.20.0:
result1
andresult2
each look fine in isolation (however, see my comment in Possible indentation change for array initializers #658 regarding "the rectangle rule").result3
I believe follows a specific rule but appears to me inconsistent with bothresult1
andresult2
.result4
is inconsistent withresult2
andresult3
both, but arguably consistent withresult1
.result1
andresult2
are semantically equivalent, as isresult3
withresult4
.The text was updated successfully, but these errors were encountered: