From 1520213d32576d0987683c923d64a024f1bf0bd2 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 9 Jun 2026 18:56:45 +0200 Subject: [PATCH] Colour the 'allows ref struct' anti-constraint The C# 13 'allows ref struct' anti-constraint is emitted as a single PrimitiveType token (TypeSystemAstBuilder), so it reached WritePrimitiveType rather than WriteKeyword and fell through uncoloured. Add it to the value-type keyword group alongside the other constraint, 'unmanaged'. Assisted-by: Claude:claude-opus-4-8:Claude Code --- ILSpy/Languages/CSharpHighlightingTokenWriter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ILSpy/Languages/CSharpHighlightingTokenWriter.cs b/ILSpy/Languages/CSharpHighlightingTokenWriter.cs index b48ec42d4..1bfc64de1 100644 --- a/ILSpy/Languages/CSharpHighlightingTokenWriter.cs +++ b/ILSpy/Languages/CSharpHighlightingTokenWriter.cs @@ -322,6 +322,9 @@ namespace ILSpy.Languages case "ushort": case "ulong": case "unmanaged": + // The C# 13 'allows ref struct' anti-constraint is emitted as a single PrimitiveType + // token (TypeSystemAstBuilder), so it is coloured here as one unit rather than per word. + case "allows ref struct": case "nint": case "nuint": color = valueTypeKeywordsColor;