提交 5acbd1c3 编写于 作者: C Cyrus Najmabadi

simplify

上级 20d2876b
...@@ -716,18 +716,13 @@ private bool ReplacementBreaksQueryClause(QueryClauseSyntax originalClause, Quer ...@@ -716,18 +716,13 @@ private bool ReplacementBreaksQueryClause(QueryClauseSyntax originalClause, Quer
!SymbolInfosAreCompatible(originalClauseInfo.OperationInfo, newClauseInfo.OperationInfo); !SymbolInfosAreCompatible(originalClauseInfo.OperationInfo, newClauseInfo.OperationInfo);
} }
private static bool IsPotentiallyTargetTypedConditionalExpression(ExpressionSyntax expressionSyntax)
{
return expressionSyntax is ConditionalExpressionSyntax &&
ConditionalExpressionConversionsAreAllowed(expressionSyntax);
}
protected override bool ReplacementIntroducesErrorType(ExpressionSyntax originalExpression, ExpressionSyntax newExpression) protected override bool ReplacementIntroducesErrorType(ExpressionSyntax originalExpression, ExpressionSyntax newExpression)
{ {
// The base implementation will see that the type of the new expression may potentially change to null, // The base implementation will see that the type of the new expression may potentially change to null,
// because the expression has no type but can be converted to a conditional expression type. In that case, // because the expression has no type but can be converted to a conditional expression type. In that case,
// we don't want to consider the null type to be an error type. // we don't want to consider the null type to be an error type.
if (IsPotentiallyTargetTypedConditionalExpression(newExpression) && if (newExpression.IsKind(SyntaxKind.ConditionalExpression) &&
ConditionalExpressionConversionsAreAllowed(newExpression) &&
this.SpeculativeSemanticModel.GetConversion(newExpression).IsConditionalExpression) this.SpeculativeSemanticModel.GetConversion(newExpression).IsConditionalExpression)
{ {
return false; return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册