Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -4,6 +4,7 @@

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations;
Expand All @@ -28,4 +29,26 @@ class Test {
unsafe void N() {
delegate*$$
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81015")]
public Task TestInFunctionPointerDeclarationAfterTyping()
=> VerifyKeywordAsync(
"""
class Test {
unsafe void N() {
delegate*manag$$
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81015")]
public Task TestInCastExpressionAfterTyping()
=> VerifyKeywordAsync(
"""
class C
{
unsafe static void M()
{
_ = (delegate*manag$$)&M;
}
}
""");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations;
Expand Down Expand Up @@ -205,4 +206,26 @@ class Test {
unsafe void N() {
delegate*$$
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81015")]
public Task TestInFunctionPointerDeclarationAfterTyping()
=> VerifyKeywordAsync(
"""
class Test {
unsafe void N() {
delegate*unman$$
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/81015")]
public Task TestInCastExpressionAfterTyping()
=> VerifyKeywordAsync(
"""
class C
{
unsafe static void M()
{
_ = (delegate*unman$$)&M;
}
}
""");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3071,7 +3071,6 @@ public static bool IsEnumTypeMemberAccessContext(this SyntaxTree syntaxTree, Sem
public static bool IsFunctionPointerCallingConventionContext(this SyntaxTree syntaxTree, SyntaxToken targetToken)
{
return targetToken.IsKind(SyntaxKind.AsteriskToken) &&
targetToken.Parent is FunctionPointerTypeSyntax functionPointerType &&
targetToken == functionPointerType.AsteriskToken;
targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
}
}