Skip to content

Commit

Permalink
VBOverloadResolutionPriority: clone remaining C# tests for the feature (
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyTs authored Dec 3, 2024
1 parent 9e8ad61 commit efeb43a
Show file tree
Hide file tree
Showing 2 changed files with 1,227 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2600,30 +2600,29 @@ public void HonoredInsideExpressionTree()
{
var source = """
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
Expression<Action> e = () => C.M(1, 2, 3);
Expression<Action> e = () => C.M("");
e.Compile()();
public class C
{
public static void M(params int[] a)
public static void M(string a)
{
throw null;
}
[OverloadResolutionPriority(1)]
public static void M(params IEnumerable<int> e)
public static void M(object e)
{
System.Console.Write(1);
}
}
""";

CreateCompilation([source, OverloadResolutionPriorityAttributeDefinition]).VerifyDiagnostics(
// (6,30): error CS9226: An expression tree may not contain an expanded form of non-array params collection parameter.
// Expression<Action> e = () => C.M(1, 2, 3);
Diagnostic(ErrorCode.ERR_ParamsCollectionExpressionTree, "C.M(1, 2, 3)").WithLocation(6, 30)
);
var comp = CreateCompilation([source, OverloadResolutionPriorityAttributeDefinition]);
CompileAndVerify(comp, expectedOutput: "1").VerifyDiagnostics();
}

[Fact]
Expand Down
Loading

0 comments on commit efeb43a

Please sign in to comment.