Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
merge origin/main
  • Loading branch information
meziantou committed Jan 15, 2026
commit 69bbc378667898757c09668095f52f2a48d13f4e
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,74 @@ await CreateProjectBuilder()
.ValidateAsync();
}

[Fact]
public async Task InternalDelegateUsedInNewExpression_NoDiagnostic()
{
const string SourceCode = """
using System;

internal delegate void MyDelegate(string key, string comment, TimeSpan timeout, out string lockToken);

public class Consumer
{
public void Method()
{
var callback = new MyDelegate((string key, string comment, TimeSpan timeout, out string lockToken) =>
{
lockToken = "42";
});
}
}
""";
await CreateProjectBuilder()
.WithSourceCode(SourceCode)
.ValidateAsync();
}

[Fact]
public async Task PrivateDelegateUsedInNewExpression_NoDiagnostic()
{
const string SourceCode = """
using System;

public class OuterClass
{
private delegate void TryAcquireLockDelegate(string key, string comment, TimeSpan timeout, out string lockToken);

public void Method()
{
var callback = new TryAcquireLockDelegate((string key, string comment, TimeSpan timeout, out string lockToken) =>
{
lockToken = "test";
});
}
}
""";
await CreateProjectBuilder()
.WithSourceCode(SourceCode)
.ValidateAsync();
}

[Fact]
public async Task UnusedInternalDelegate_Diagnostic()
{
const string SourceCode = """
using System;

internal delegate void [|UnusedDelegate|](string message);

public class Consumer
{
public void Method()
{
}
}
""";
await CreateProjectBuilder()
.WithSourceCode(SourceCode)
.ValidateAsync();
}


[Fact]
public async Task InternalClassWithFactoryMethod_NoDiagnostic()
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.