Skip to content

Commit f3ee529

Browse files
Fix condition in Debug.Assert in TarEntry.cs (#100860)
* Fix condition in Debug.Assert The precedence of `not` is higher than of `or`, so without parentheses the actual condition was `((not RegularFile) or V7RegularFile or ContigousFile)`, which is not what this function actually expects (see switch cases and the condition in caller function). * Fix assert condition in UnconditionalSuppressMessageAttributeState.cs Similar to previous commit --------- Co-authored-by: Stephen Toub <[email protected]>
1 parent fdef8db commit f3ee529

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ private Task ExtractToFileInternalAsync(string filePath, string? linkTargetPath,
439439

440440
private void CreateNonRegularFile(string filePath, string? linkTargetPath)
441441
{
442-
Debug.Assert(EntryType is not TarEntryType.RegularFile or TarEntryType.V7RegularFile or TarEntryType.ContiguousFile);
442+
Debug.Assert(EntryType is not (TarEntryType.RegularFile or TarEntryType.V7RegularFile or TarEntryType.ContiguousFile));
443443

444444
switch (EntryType)
445445
{

src/tools/illink/src/linker/Linker/UnconditionalSuppressMessageAttributeState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static bool TryDecodeSuppressMessageAttributeData (CustomAttribute attribute, ou
257257

258258
IEnumerable<Suppression> DecodeSuppressions (ICustomAttributeProvider provider)
259259
{
260-
Debug.Assert (provider is not ModuleDefinition or AssemblyDefinition);
260+
Debug.Assert (provider is not (ModuleDefinition or AssemblyDefinition));
261261

262262
if (!_context.CustomAttributes.HasAny (provider))
263263
yield break;

0 commit comments

Comments
 (0)