提交 6358e717 编写于 作者: R Ravi Chande

Show object creation completion before braces

Fixes #13402
上级 f60c7fd0
......@@ -2028,5 +2028,22 @@ public async Task TestDeconstruction()
await TestInMethodAsync(
@"[|(int i, _)|] =", "global::System.Object");
}
[WorkItem(13402, "https://github.com/dotnet/roslyn/issues/13402")]
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
public async Task TestObjectCreationBeforeBlock()
{
var text =
@"class Program
{
static void Main(string[] args)
{
Program p = new [||]
{ }
}
}";
await TestAsync(text, "global::Program", testNode: false);
}
}
}
\ No newline at end of file
......@@ -191,6 +191,7 @@ protected override IEnumerable<TypeInferenceInfo> InferTypesWorker_DoNotCallDire
switch (parent)
{
case AnonymousObjectCreationExpressionSyntax anonymousObjectCreation: return InferTypeInAnonymousObjectCreation(anonymousObjectCreation);
case AnonymousObjectMemberDeclaratorSyntax memberDeclarator: return InferTypeInMemberDeclarator(memberDeclarator, token);
case ArgumentListSyntax argument: return InferTypeInArgumentList(argument, token);
case ArgumentSyntax argument: return InferTypeInArgument(argument, token);
......@@ -240,6 +241,8 @@ protected override IEnumerable<TypeInferenceInfo> InferTypesWorker_DoNotCallDire
}
}
private IEnumerable<TypeInferenceInfo> InferTypeInAnonymousObjectCreation(AnonymousObjectCreationExpressionSyntax expression) => InferTypes(expression.SpanStart);
private IEnumerable<TypeInferenceInfo> InferTypeInArgument(
ArgumentSyntax argument, SyntaxToken? previousToken = null)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册