-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Disable EnC for active methods with v7 syntax and for any method with v7 switch statement #13754
Conversation
Re
There would only be a single client for that API - this code. We prefer to see at least two and preferably three potential clients to add a public API. |
@@ -268,6 +268,7 @@ override Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax.Accept<TResult>(M | |||
static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ILocalSymbol | |||
static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.SingleVariableDesignationSyntax designationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol | |||
static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetForEachStatementInfo(this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.CommonForEachStatementSyntax forEachStatement) -> Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo | |||
static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.IsValidV6SwitchGoverningType(this Microsoft.CodeAnalysis.ITypeSymbol type) -> bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsValidV6SwitchGoverningType [](start = 54, length = 28)
Please do not add this public API. Instead use the code from #13334 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works too. Thanks
Should this method be extended to handle new node kinds? Refers to: src/Features/CSharp/Portable/EditAndContinue/StatementSyntaxComparer.cs:572 in 2b29f9a. [](commit_id = 2b29f9a7070131fb066bb9cac769ecb2e455f0f1, deletion_comment = False) |
CC @dotnet/roslyn-interactive |
<comment>{Locked="ref"} "ref" is a C# keyword and should not be localized.</comment> | ||
</data> | ||
<data name="v7_switch" xml:space="preserve"> | ||
<value>v7 switch</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v7 [](start = 11, length = 2)
Should we find a friendlier description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to "C# 7 enhanced switch statement".
When I tried EnC in VS, I was not able to observe the error message or the diagnostics, except for an error popup with a generic message (there was an error with this edit & continue) and squiggles on the span. I didn't see anything in the error or output panes.
Do you know if the error message appears somewhere else?
Should we add Deconstruction Declaration here? Refers to: src/Features/CSharp/Portable/EditAndContinue/StatementSyntaxComparer.cs:192 in 2b29f9a. [](commit_id = 2b29f9a7070131fb066bb9cac769ecb2e455f0f1, deletion_comment = False) |
switch (n.Kind()) | ||
{ | ||
case SyntaxKind.IsPatternExpression: | ||
case SyntaxKind.DeconstructionDeclarationStatement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeconstructionDeclarationStatement [](start = 32, length = 34)
Should we also handle VariableComponentAssignmentSyntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. That scenario was already caught by the tuples check, but this will make it safer to incrementally enable scenarios.
@gafter @AlekseyTs Regarding StatementSyntaxComparer.cs (around line 192), I only made the smallest change here to unblock the scenarios. As far as I can tell, the reason the new |
I changed the PR to point to the preview5 branch. |
@dotnet-bot retest vsi please |
@dotnet-bot test eta please |
case SyntaxKind.SelectClause: | ||
return ((SelectClauseSyntax)node).SelectKeyword.Span; | ||
|
||
case SyntaxKind.GroupClause: | ||
return ((GroupClauseSyntax)node).GroupKeyword.Span; | ||
|
||
case SyntaxKind.ForEachComponentStatement: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we gain anything by grouping cases with the same body? Won't the compiler do that anyway? I'm guessing the old order was deliberate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not discern any order and found it confusing to have them spread out. I'll revert that refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undid the refactoring.
test eta please |
1 similar comment
test eta please |
@dotnet/roslyn-compiler for a second review. This is fairly urgent as preview-5 ask mode closes later today. Thanks |
@dotnet-bot test windows_vsi_p1_open_prtest please |
Adding a syntactic check for any v7 syntax around active statement during EnC. This is modeled after a similar check in VB for "on error or resume" statement.
Also adding a semantic check for v7 switch statement (looking at governing type of the switch).
Addresses some of the work items in #12379
@gafter I think it would be good to re-open your PR (#13498) with public API for checking v7 switch statement. I copied that method to unblock myself for now.
Since tuples and ref shouldn't affect EnC slots, I'm thinking to allow them. Any thoughts?
If this change looks good, I will do a similar change for VB.
@dotnet/roslyn-compiler for review.