Skip to content

Commit

Permalink
Visit collection expression elements as r-values (#75365)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz authored Oct 4, 2024
1 parent 9530e2f commit 3b64495
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3661,7 +3661,7 @@ protected override void VisitStatement(BoundStatement statement)
SetUnknownResultNullability(initializer);
Debug.Assert(node.Placeholder is { });
SetUnknownResultNullability(node.Placeholder);
Visit(initializer.Arguments[0]);
VisitRvalue(initializer.Arguments[0]);
break;
case BoundCollectionExpressionSpreadElement spread:
// https://github.com/dotnet/roslyn/issues/68786: We should check the spread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ private static bool IsNullableAnalysisEnabled(CSharpCompilation compilation, str
return method.IsNullableAnalysisEnabled();
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/75343")]
public void CollectionExpressionBool()
{
var source = """
#nullable enable
System.Collections.Generic.List<bool> l = [false, true, false];
""";
CreateCompilation(source).VerifyDiagnostics();
}

[Fact]
public void DefaultLiteralInConditional()
{
Expand Down

0 comments on commit 3b64495

Please sign in to comment.