未验证 提交 11e08c6c 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #23946 from zaytsev-victor/Fixed23940

Fixed VS2017 crash with :: operator
......@@ -2323,5 +2323,27 @@ void Main(string s)
}
}", Keyword("var"));
}
[WorkItem(23940, "https://github.com/dotnet/roslyn/issues/23940")]
[WpfFact, Trait(Traits.Feature, Traits.Features.Classification)]
public async Task TestAliasQualifiedClass()
{
await TestAsync(
@"
using System;
using Col = System.Collections.Generic;
namespace AliasTest
{
class Program
{
static void Main(string[] args)
{
var list1 = new Col::List
}
}
}",
Keyword("var"), Class("List"));
}
}
}
......@@ -211,7 +211,7 @@ private static ISymbol TryGetSymbol(NameSyntax name, SymbolInfo symbolInfo, Sema
break;
case CandidateReason.WrongArity:
if (name.GetRightmostName().Arity == 0)
if (name.GetRightmostName()?.Arity == 0)
{
// When the user writes something like "IList" we don't want to *not* classify
// just because the type bound to "IList<T>". This is also important for use
......
......@@ -2578,6 +2578,11 @@ public static SimpleNameSyntax GetRightmostName(this ExpressionSyntax node)
return memberBinding.Name;
}
if (node is AliasQualifiedNameSyntax aliasQualifiedName && aliasQualifiedName.Name != null)
{
return aliasQualifiedName.Name;
}
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册