Skip to content

Commit

Permalink
Revisit/simplify BindYieldReturnStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Oct 31, 2024
1 parent 42b26cf commit 6b79fe7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, Bindi
? BadExpression(node).MakeCompilerGenerated()
: BindValue(node.Expression, diagnostics, BindValueKind.RValue);

if (!argument.HasErrors && ((object)argument.Type == null || !argument.Type.IsErrorType()))
if (elementType is not null)
{
argument = GenerateConversionForAssignment(elementType, argument, diagnostics);
}
Expand Down

0 comments on commit 6b79fe7

Please sign in to comment.