Skip to content

Commit a4390cc

Browse files
Don't qualify non-static generic names
1 parent b397287 commit a4390cc

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ public override async Task<CSharpSyntaxNode> VisitGenericName(VBasic.Syntax.Gene
11771177
ExpressionSyntax name = genericNameSyntax;
11781178

11791179

1180-
if (symbol?.ContainingSymbol != null) {
1180+
if (symbol?.IsStatic == true && symbol.ContainingSymbol != null) {
11811181

11821182
if (!node.Parent.IsKind(VBasic.SyntaxKind.SimpleMemberAccessExpression, VBasic.SyntaxKind.QualifiedName)) {
11831183

Tests/CSharp/ExpressionTests/AccessExpressionTests.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,16 +649,14 @@ public partial class MoreParsing
649649
{
650650
public void DoGet()
651651
{
652-
var anon = new { TheType = MoreParsing.GetEnumValues<TheType>() };
652+
var anon = new { TheType = GetEnumValues<TheType>() };
653653
}
654654
655655
private IDictionary<int, string> GetEnumValues<TEnum>()
656656
{
657657
return Enum.GetValues(typeof(TEnum)).Cast<TEnum>().ToDictionary(enumValue => (int)(object)enumValue, enumValue => enumValue.ToString());
658658
}
659-
}
660-
1 target compilation errors:
661-
CS0120: An object reference is required for the non-static field, method, or property 'MoreParsing.GetEnumValues<TheType>()'");
659+
}");
662660
}
663661

664662
[Fact]

0 commit comments

Comments
 (0)