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
{{ message }}
Repository navigation
Investigate whether the function pointer spacing exception belongs in SA1014 or SA1023 #153
In delegate* <int, void>, the space between * and < could be reported by two rules: SA1014 ("opening generic bracket should not be preceded by a space") and SA1023 ("dereference symbol should not be followed by a space"). To avoid duplicate diagnostics, SA1014 currently skips its "preceded" check when the < follows the * (SA1014OpeningGenericBracketsMustBeSpacedCorrectly.cs, token.GetPreviousToken().IsKind(SyntaxKind.AsteriskToken)). The space is left to SA1023.
Investigate whether the exception should be moved to SA1023 instead.
Arguments for keeping it in SA1014 (current behavior):
SA1023 has reported this space since function pointers were added upstream (SA1023CSharp9UnitTests.TestFunctionPointerTypeInvalidSpacingAsync, delegate* <int*>). Moving it changes that tested behavior, and users with SA1014 disabled would no longer get the diagnostic.
SA1023 already decides what may follow the *: no space before <, but a space before managed/unmanaged.
It matches how other spacing rules split overlaps: the rule for the later token skips its "preceded" check when the earlier token's rule covers the space (e.g. SA1008 after another (, or after keywords handled by SA1000).
Arguments for moving it to SA1023:
SA1014 would then report a space before < the same way everywhere in a function pointer: after *, after managed/unmanaged and after unmanaged[Cdecl].
Affected tests: SA1014CSharp9UnitTests.TestFunctionPointerWithSpaceAfterAsteriskAsync and SA1023CSharp9UnitTests.TestFunctionPointerTypeInvalidSpacingAsync.
Activity