提交 3c64b27a 编写于 作者: V VSadov

Fixing a crash in SuppressDefaultTupleElements

We were missing a null check fo the container. In broken code it can be null.
Fixes: #14546
上级 b159bb5c
......@@ -8904,6 +8904,23 @@ void foo()
await VerifyItemExistsAsync(markup, "Item3");
}
[WorkItem(14546, "https://github.com/dotnet/roslyn/issues/14546")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task TupleElementsCompletionOffMethodGroup()
{
var markup = @"
class C
{
void foo()
{
new object().ToString.$$
}
}" + TestResources.NetFX.ValueTuple.tuplelib_cs;
// should not crash
await VerifyItemExistsAsync(markup, "ToString");
}
[Fact]
[Trait(Traits.Feature, Traits.Features.Completion)]
[Test.Utilities.CompilerTrait(Test.Utilities.CompilerFeature.LocalFunctions)]
......
......@@ -81,7 +81,7 @@ internal abstract class AbstractRecommendationService : IRecommendationService
protected static ImmutableArray<ISymbol> SuppressDefaultTupleElements(
INamespaceOrTypeSymbol container, ImmutableArray<ISymbol> symbols)
{
if (!container.IsType)
if (container?.IsType != true)
{
return symbols;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册