Add nullable annotations to EnC impl#39195
Conversation
|
@ivanbasov PTAL |
|
@sharwell FYI |
| using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
| using Roslyn.Utilities; | ||
|
|
||
| #nullable enable |
There was a problem hiding this comment.
💡 I've been putting this at the top (first item after copyright header). Placement here might make me miss it when looking through files in the future to see what work remains.
There was a problem hiding this comment.
Feel free to move it up to unify.
| } | ||
|
|
||
| private bool TryMapParameter(ValueTuple<SyntaxNode, int> parameterKey, IReadOnlyDictionary<SyntaxNode, SyntaxNode> map, out ValueTuple<SyntaxNode, int> mappedParameterKey) | ||
| private bool TryMapParameter((SyntaxNode? Node, int Ordinal) parameterKey, IReadOnlyDictionary<SyntaxNode, SyntaxNode> map, out (SyntaxNode? Node, int Ordinal) mappedParameterKey) |
There was a problem hiding this comment.
💡 The naming convention here deviates from the naming convention through the rest of this project.
| private bool TryMapParameter((SyntaxNode? Node, int Ordinal) parameterKey, IReadOnlyDictionary<SyntaxNode, SyntaxNode> map, out (SyntaxNode? Node, int Ordinal) mappedParameterKey) | |
| private bool TryMapParameter((SyntaxNode? node, int ordinal) parameterKey, IReadOnlyDictionary<SyntaxNode, SyntaxNode> map, out (SyntaxNode? node, int ordinal) mappedParameterKey) |
There was a problem hiding this comment.
I don't think we have actually agreed on a common convention for tuples.
| else | ||
| { | ||
| topMatch.TryGetOldNode(typeSyntax, out partner); | ||
| _ = topMatch.TryGetOldNode(typeSyntax, out partner); |
There was a problem hiding this comment.
To make it explicit that we ignore the result. In this case the suggestion to be explicit that the analyzer reports makes sense.
| { | ||
| GetDisplayName(syntax, EditKind.Insert), | ||
| GetDisplayName(TryGetContainingTypeDeclaration(syntax), EditKind.Update) | ||
| GetDisplayName(TryGetContainingTypeDeclaration(syntax)!, EditKind.Update) |
There was a problem hiding this comment.
❔ Why do we know this one is valid?
There was a problem hiding this comment.
The method is only called with syntax being a syntax of a field, property, or event of a type. So there will always be a containing type declaration.
No description provided.