Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup improper parenthesized expression in 'use pattern combinators'. #73391

Merged
merged 2 commits into from
May 8, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented May 8, 2024

Extracted from #73357.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 8, 2024 16:54
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 8, 2024
@@ -103,7 +103,7 @@ public async Task TestMissingOnExpression(string expression)
await TestAllMissingOnExpressionAsync(expression);
}

[InlineData("i == default || i > default(int)", "i is default(int) or > (default(int))")]
[InlineData("i == default || i > default(int)", "i is default(int) or > default(int)")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the bug that was being fixed.

@@ -166,9 +166,6 @@ private static bool AddSimpleName(SimpleNameSyntax simpleName, List<string> part
return true;
}

public static bool IsAnyLiteralExpression(this ExpressionSyntax expression)
=> expression is LiteralExpressionSyntax;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pointless helper. removed as i would prefer people make the direct and clear type checks.

// (checked(1)) -> checked(1)
// (unchecked(1)) -> unchecked(1)
// (sizeof(int)) -> sizeof(int)
if (expression is TypeOfExpressionSyntax or DefaultExpressionSyntax or CheckedExpressionSyntax or SizeOfExpressionSyntax)
return true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the fix.

@CyrusNajmabadi CyrusNajmabadi merged commit b8b6a0d into dotnet:main May 8, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone May 8, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the usePatternFix branch May 8, 2024 18:34
@Cosifne Cosifne modified the milestones: Next, 17.11 P2 May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants