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

Remove withinTypeSyntax restriction for UseExplicit/ImplicitType refactoring. #38322

Merged
merged 1 commit into from
Aug 29, 2019

Conversation

petrroll
Copy link
Contributor

@petrroll petrroll commented Aug 27, 2019

Lifts a restriction that selection/caret must intersect the typeSyntax for Use[Explicit/Implicit]Type refactoring.

While it potentially introduces noise (addition refactorings) it shouldn't be much of an issue do to the way ordering works. Since the applicableToSpan is still the type, the distance to it should be sufficiently larger than to any other refactoring.

If it proves to be problematic the ordering via applicableToSpan should be updated to create distance for refactorings that whose applicableToSpan doesn't intersect current selection/caret location.

Work for #35525

@petrroll petrroll changed the base branch from master to release/dev16.4-preview1 August 27, 2019 23:37
if (typeNodeParent != null && typeNodeParent.IsKind(SyntaxKind.DeclarationExpression, SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement))
if (typeNodeParent != null &&
(typeNodeParent.IsKind(SyntaxKind.DeclarationExpression, SyntaxKind.VariableDeclaration) ||
(typeNodeParent.IsKind(SyntaxKind.ForEachStatement) && !syntaxFacts.IsExpressionOfForeach(typeNode))))
Copy link
Member

@mavasani mavasani Aug 28, 2019

Choose a reason for hiding this comment

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

Do we have existing tests that validate the last check about expression of foreach, i.e no refactoring offered for int i inside foreach (int i in [|new[] { 0 }|]) { }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petrroll petrroll changed the base branch from release/dev16.4-preview1 to master August 29, 2019 17:50
@petrroll petrroll merged commit 3aae015 into dotnet:master Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants