Closed brian-reichle closed 1 year ago
The following triggers WTG3103, apparently because the trailing comma is considered to be part of the broader list rather than the ISpanFormattable case itself.
return item switch { null => builder, #if NET6_0_OR_GREATER ISpanFormattable spanFormattable => builder.AppendSpanFormattableValue(formatProvider, spanFormattable, format), #endif IFormattable formattable => builder.AppendFormattableValue(formatProvider, formattable, format), _ => builder.Append(item.ToString()), };
Array initializers and enums have the same issue.
var bob = new[] { "A", #if NET6_0_OR_GREATER "B", #endif "C", };
enum MetaSyntaticVariable { A, #if NET6_0_OR_GREATER B, #endif C, }
Perhaps we should relax WTG3103 when dealing with comma separated lists and treat the comma as part of the preceding item.
Sounds good to me.
The following triggers WTG3103, apparently because the trailing comma is considered to be part of the broader list rather than the ISpanFormattable case itself.
Array initializers and enums have the same issue.
Perhaps we should relax WTG3103 when dealing with comma separated lists and treat the comma as part of the preceding item.