Skip to content

Commit

Permalink
Address feedback from Chuck
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Nov 10, 2018
1 parent 875554c commit c06f8af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ protected override BoundNode VisitReturnStatementNoAdjust(BoundReturnStatement n
Debug.Assert(!IsConditionalState);

BoundExpression expr = node.ExpressionOpt;
if (expr == null || expr.HasErrors)
if (expr == null)
{
return null;
}
Expand Down Expand Up @@ -4595,7 +4595,7 @@ public override BoundNode VisitThrowExpression(BoundThrowExpression node)
public override BoundNode VisitYieldReturnStatement(BoundYieldReturnStatement node)
{
BoundExpression expr = node.Expression;
if (expr == null || expr.HasErrors)
if (expr == null)
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22598,6 +22598,9 @@ static void F(object? x)
// (5,13): error CS0815: Cannot assign lambda expression to an implicitly-typed variable
// var z = y => y ?? x.ToString();
Diagnostic(ErrorCode.ERR_ImplicitlyTypedVariableAssignedBadValue, "z = y => y ?? x.ToString()").WithArguments("lambda expression").WithLocation(5, 13),
// (5,27): warning CS8602: Possible dereference of a null reference.
// var z = y => y ?? x.ToString();
Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(5, 27),
// (6,53): warning CS8602: Possible dereference of a null reference.
// System.Func<object?, object> z2 = y => y ?? x.ToString();
Diagnostic(ErrorCode.WRN_NullReferenceReceiver, "x").WithLocation(6, 53),
Expand Down Expand Up @@ -38346,6 +38349,12 @@ public void ExplicitCast_StaticType()
// (3,35): error CS0716: Cannot convert to static type 'C'
// static object F(object? x) => (C)x;
Diagnostic(ErrorCode.ERR_ConvertToStaticClass, "(C)x").WithArguments("C").WithLocation(3, 35),
// (3,35): warning CS8600: Converting null literal or possible null value to non-nullable type.
// static object F(object? x) => (C)x;
Diagnostic(ErrorCode.WRN_ConvertingNullableToNonNullable, "(C)x").WithLocation(3, 35),
// (3,35): warning CS8603: Possible null reference return.
// static object F(object? x) => (C)x;
Diagnostic(ErrorCode.WRN_NullReferenceReturn, "(C)x").WithLocation(3, 35),
// (4,36): error CS0716: Cannot convert to static type 'C'
// static object? G(object? y) => (C?)y;
Diagnostic(ErrorCode.ERR_ConvertToStaticClass, "(C?)y").WithArguments("C").WithLocation(4, 36));
Expand Down

0 comments on commit c06f8af

Please sign in to comment.