-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Remove invalid implicit downcast #19932
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
Conversation
|
Given that there was no activity on this PR in a while, I'm marking it as "for personal review" for now (so it doesn't show up in our daily list of PRs to review). Thanks |
|
@jcouv this has been updated again |
src/CodeStyle/Core/Analyzers/Extensions/CodeStyleSeparatedSyntaxListExtensions.cs
Outdated
Show resolved
Hide resolved
Have you considered replacing the implicit operator with a regular method with the same name an signature instead? That should take care of binary compatibility. Then we can add an explicit operator. |
💭 No, but I'll try now |
TIL! :-) |
|
@AlekseyTs Now updated to preserve the implicit operator using its metadata name instead of |
| public virtual SyntaxList<TNode> VisitList<TNode>(SyntaxList<TNode> list) where TNode : SyntaxNode | ||
| { | ||
| SyntaxListBuilder? alternate = null; | ||
| SyntaxListBuilder<TNode> alternate = default; |
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.
Is this change primarily related to the stated goal of the PR? If not, please consider separating it into its own PR.
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.
It is related. SyntaxListBuilder produced a SyntaxList<SyntaxNode> which needs an explicit downcast. SyntaxListBuilder<TNode> produces SyntaxList<TNode> and removes the need for a downcast.
AlekseyTs
left a 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.
Changes under Compilers LGTM, modulo possibly unrelated change in CSharpSyntaxRewriter.cs
AlekseyTs
left a 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.
Changes under Compilers LGTM (commit 9)
|
@dotnet/roslyn-compiler For the second review. |
333fred
left a 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.
Changes under compilers look fine, but not signing off until build and test issues are corrected.
333fred
left a 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.
Compiler changes LGTM (commit 11)
|
@sharwell this PR has appropriate sign offs. It's a bit stale so we probably want to re-run CI here. But are you intending to move forward with this? If not I would like to close to get it off our review queue. |
|
Have not heard back so moving to draft. |
|
@jaredpar Sorry got hit by the command line build failures when I tried to update. Trying again locally and hopefully should work out. |
Currently
SeparatedSyntaxList<SyntaxNode>can be implicitly cast toSeparatedSyntaxList<T>for any syntax typeT. This is not a safe or meaningful conversion, so this change seeks to remove it.No explicit operator could be added because the implicit operator was not removed, so aAn explicit operator alongside theCastDownmethod is added to provide the functionality via an explicit methodop_Implicitmethod using the operator syntax.