Skip to content

Commit d38a4fd

Browse files
Fix two compiler warnings.
* CompoundAssignmentInstruction.cs (CS9336) — the C# 9 IntPtr / UIntPtr guard read `type.Kind is not TypeKind.NInt or TypeKind.NUInt`, which parses as `(is not NInt) or (is NUInt)` — true unless Kind == NInt. The intent (per the comment "but not nint or C# 11 IntPtr") is "Kind is neither NInt nor NUInt", which needs parentheses around the alternation: `is not (NInt or NUInt)`. Effect: when Kind == NUInt the branch no longer mistakenly applies the C# 9 IntPtr-only restrictions. * IMethod.IsAsync (CS1574) — `<see cref="MethodImplAttributes.Async"/>` doesn't resolve on netstandard2.0 (the enum value was added later; this codebase declares its own SRMExtensions.MethodImplAsync = 0x2000 for that reason). Rewrite the doc comment in prose to describe the flag without an unresolvable cref. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f8c8649 commit d38a4fd

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

ICSharpCode.Decompiler/IL/Instructions/CompoundAssignmentInstruction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ internal static bool IsBinaryCompatibleWithType(BinaryNumericInstruction binary,
215215
return false; // operator not supported on pointer types
216216
}
217217
}
218-
else if ((type.IsKnownType(KnownTypeCode.IntPtr) || type.IsKnownType(KnownTypeCode.UIntPtr)) && type.Kind is not TypeKind.NInt or TypeKind.NUInt)
218+
else if ((type.IsKnownType(KnownTypeCode.IntPtr) || type.IsKnownType(KnownTypeCode.UIntPtr)) && type.Kind is not (TypeKind.NInt or TypeKind.NUInt))
219219
{
220220
// If the LHS is C# 9 IntPtr (but not nint or C# 11 IntPtr):
221221
// "target.intptr *= 2;" is compiler error, but

ICSharpCode.Decompiler/TypeSystem/IMethod.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ public interface IMethod : IParameterizedMember
113113
new IMethod Specialize(TypeParameterSubstitution substitution);
114114

115115
/// <summary>
116-
/// Returns <see langword="true"/>, if the method is <see cref="MethodImplAttributes.Async"/>.
116+
/// Returns <see langword="true"/> if the method has the runtime-async
117+
/// <c>MethodImpl</c> flag set (the <c>0x2000</c> bit on
118+
/// <see cref="System.Reflection.MethodImplAttributes"/>);
117119
/// <see langword="false"/> otherwise.
118120
/// </summary>
119121
bool IsAsync { get; }

0 commit comments

Comments
 (0)