Skip to content

Commit

Permalink
Add test demonstrating issue doesn't arise (#76025)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi authored Nov 22, 2024
2 parents cac0219 + ec42cb1 commit 13be083
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
Expand Down Expand Up @@ -98,7 +97,7 @@ private void SyntaxNodeAction(
isKeyword.GetLocation(),
styleOption.Notification,
context.Options,
ImmutableArray.Create(node.GetLocation()),
[node.GetLocation()],
properties: null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,44 @@ void M()
LanguageVersion = LanguageVersion.CSharp9,
}.RunAsync();
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/62078")]
public async Task TestTypeVersusMemberAmbiguity()
{
await new VerifyCS.Test
{
TestCode = """
class Color { }

class C
{
public const int Color = 0;

void M(object x)
{
if (!(x [|is|] Color))
{
}
}
}
""",
FixedCode = """
class Color { }

class C
{
public const int Color = 0;

void M(object x)
{
if (x is not global::Color)
{
}
}
}
""",
LanguageVersion = LanguageVersion.CSharp9,
CodeActionValidationMode = Testing.CodeActionValidationMode.None,
}.RunAsync();
}
}

0 comments on commit 13be083

Please sign in to comment.