提交 d62e8eee 编写于 作者: J Jason Malinowski

Remove calls to our extensions of TypeInfo that return annotated nullability

TypeInfo explicitly returns a Type or ConvertedType, the top-level
nullability of which is the flow state nullability. It also explicitly
gives you annotated nullability prior to us including nullability
in with types. This PR removes the explicit use of the annotated
nullability when it doesn't matter, namely when the thing you're
calling GetTypeInfo is already a TypeSyntax so the 'flow state' was
never really a flow state to begin with.
上级 470e824c
......@@ -62,7 +62,7 @@ public override bool ContainingScopeHasAsyncKeyword()
var variableDeclExpression = node.GetAncestorOrThis<VariableDeclarationSyntax>();
if (variableDeclExpression != null)
{
return model.GetTypeInfo(variableDeclExpression.Type).GetTypeWithAnnotatedNullability();
return model.GetTypeInfo(variableDeclExpression.Type).Type;
}
}
......
......@@ -171,7 +171,7 @@ protected override ImmutableArray<ITypeSymbol> DetermineTypeArguments(Cancellati
foreach (var typeArgument in ((GenericNameSyntax)State.SimpleNameOpt).TypeArgumentList.Arguments)
{
var typeInfo = this.Document.SemanticModel.GetTypeInfo(typeArgument, cancellationToken);
result.Add(typeInfo.GetTypeWithAnnotatedNullability());
result.Add(typeInfo.Type);
}
}
......
......@@ -90,7 +90,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
if (parensDesignation is null)
{
var typeSymbol = semanticModel.GetTypeInfo(typeSyntax.StripRefIfNeeded()).GetConvertedTypeWithAnnotatedNullability();
var typeSymbol = semanticModel.GetTypeInfo(typeSyntax.StripRefIfNeeded()).ConvertedType;
// We're going to be passed through the simplifier. Tell it to not just convert
// this back to var (as that would defeat the purpose of this refactoring entirely).
......
......@@ -1194,7 +1194,7 @@ private IEnumerable<TypeInferenceInfo> InferTypeInPropertyDeclaration(PropertyDe
Debug.Assert(propertyDeclaration?.Type != null, "Property type should never be null");
var typeInfo = SemanticModel.GetTypeInfo(propertyDeclaration.Type);
return CreateResult(typeInfo.GetTypeWithAnnotatedNullability());
return CreateResult(typeInfo.Type);
}
private IEnumerable<TypeInferenceInfo> InferTypeInExpressionStatement(ExpressionStatementSyntax expressionStatement, SyntaxToken? previousToken = null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册