Conversation
| [NotNull] | ||
| public INamedTypeSymbol? ContainingType { get; private set; } |
There was a problem hiding this comment.
This type is factory constructed. If you get an instance of it, the factory will have checked that this was not null.
There was a problem hiding this comment.
Why not just public INamedTypeSymbol ContainingType { get; }?
There was a problem hiding this comment.
i got warnings then that the constructor doesn't set it. Do we have a preferred idiom hre? It's a transitional value. but i would prefer it represent the value for the final consumer that passes this around and operates on it.
| [NotNull] | ||
| public INamedTypeSymbol? ContainingType { get; private set; } |
| public bool IsIndexerMemberCRef(SyntaxNode node) | ||
| => node.Kind() == SyntaxKind.IndexerMemberCref; | ||
| public bool IsIndexerMemberCRef(SyntaxNode? node) | ||
| => node.IsKind(SyntaxKind.IndexerMemberCref); |
There was a problem hiding this comment.
💭 It's interesting that this doesn't required the parameter attributes to match. If this isn't just a compiler oversight, perhaps we should add a code style analyzer for it?
| if (index < 0) | ||
| { | ||
| return (null, null); | ||
| return default; |
There was a problem hiding this comment.
The original form had a bunch of benefits here. If the original had used default I don't think this return would have even been flagged by NRT.
| } | ||
|
|
||
| private static (string pre, string post) GetPreAndPostTextParts(string text) | ||
| private static (string? pre, string? post) GetPreAndPostTextParts(string text) |
There was a problem hiding this comment.
💡 Based on use sites, (string pre, string post)? would be a less intrusive change here.
| if (parameter == null) | ||
| continue; |
There was a problem hiding this comment.
❔ Is this fixing a bug, or was it not reachable?
|
|
||
| if (!syntaxFacts.IsSimpleArgument(current.Parent) || | ||
| !syntaxFacts.IsElementAccessExpression(current.Parent.Parent.Parent)) | ||
| !syntaxFacts.IsElementAccessExpression(current.Parent?.Parent?.Parent)) |
There was a problem hiding this comment.
📝 This only needed ?. for the last access:
current.Parent.Parent?.Parent
|
|
||
| var collectionType = semanticModel.GetTypeInfo(collectionExpression, cancellationToken); | ||
| if (collectionType.Type == null && collectionType.Type.TypeKind == TypeKind.Error) | ||
| if (collectionType.Type == null || collectionType.Type.TypeKind == TypeKind.Error) |
There was a problem hiding this comment.
Can we add a test for this?
| var conversion = compilation.ClassifyCommonConversion(argumentTypeInfo.Type, parameterType); | ||
| if (conversion.IsImplicit) | ||
| return true; | ||
| if (argumentTypeInfo.Type != null) |
There was a problem hiding this comment.
❔ Is this not an intended precondition of the method? If it is, we could just add the following at the start of the (private) method:
Contract.ThrowIfNull(argumentTypeInfo.Type);
There was a problem hiding this comment.
Looking at call sites, it looks more complicated (i.e. null is allowed for this property if the conditions above produce an early return). We could still add a Contract.ThrowIfNull, but it would need to be at this location in the method.
| if (string.Equals(missingAssemblyIdentity.Name, candidateProject.AssemblyName, StringComparison.OrdinalIgnoreCase)) | ||
| var candidateProject = project.Solution.GetRequiredProject(candidateProjectId); | ||
| if (candidateProject.SupportsCompilation && | ||
| string.Equals(missingAssemblyIdentity.Name, candidateProject.AssemblyName, StringComparison.OrdinalIgnoreCase)) |
There was a problem hiding this comment.
@jasonmalinowski to verify if we need to add any new checks for target projects that do not support compilation
| var formatMethodsAcceptingParamsArray = formatMethods | ||
| .Where(x => x.Parameters.Length > 1 && x.Parameters[1].Type.Kind == SymbolKind.ArrayType); | ||
| if (formatMethodsAcceptingParamsArray.Contains(invocationSymbol)) | ||
| if (expression != null) |
There was a problem hiding this comment.
Can we add a test for this gap?
No description provided.