Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ private void VerifyExpression(BoundExpression expression, bool overrideSkippedEx
return null;
}

public override BoundNode? VisitCollectionExpressionSpreadElement(BoundCollectionExpressionSpreadElement node)
{
Visit(node.Expression);

if (node.Conversion is BoundConversion conversion)
{
Visit(conversion);
}

return null;
}

public override BoundNode? VisitDeconstructionAssignmentOperator(BoundDeconstructionAssignmentOperator node)
{
// https://github.com/dotnet/roslyn/issues/35010: handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47326,5 +47326,38 @@ .locals init (int V_0, //i
Assert.Contains(libraryRef, usedRefs);

}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81552")]
public void VisitedNodes_CollectionExpression()
{
var source = """
#nullable enable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

Merge([.. D.P]);

static void Merge(params ReadOnlySpan<C> cs) { }

[CollectionBuilder(typeof(C), methodName: nameof(Create))]
class C : IEnumerable<int>
{
public static C Create(ReadOnlySpan<int> span) => new();

public IEnumerator<int> GetEnumerator() => throw new NotImplementedException();

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}

class D
{
public static IEnumerable<int> P => [1];
}
""";

CompileAndVerify(CreateCompilationWithSpan([source, CollectionBuilderAttributeDefinition]), expectedOutput: "").VerifyDiagnostics();
}
}
}