提交 4f5bb196 编写于 作者: R Ravi Chande 提交者: GitHub

Merge pull request #16267 from rchande/fix15804

Show object creation intellisense when new is typed on the line befor…
......@@ -437,5 +437,21 @@ public async Task InExpressionBodiedMethod()
";
await VerifyItemExistsAsync(markup, "object");
}
[WorkItem(15804, "https://github.com/dotnet/roslyn/issues/15804")]
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async Task BeforeAttributeParsedAsImplicitArray()
{
var markup =
@"class Program
{
Program p = new $$
[STAThread]
static void Main() { }
}
";
await VerifyItemExistsAsync(markup, "Program");
}
}
}
......@@ -218,6 +218,7 @@ protected override IEnumerable<TypeInferenceInfo> InferTypesWorker_DoNotCallDire
case ForEachStatementSyntax forEachStatement: return InferTypeInForEachStatement(forEachStatement, previousToken: token);
case ForStatementSyntax forStatement: return InferTypeInForStatement(forStatement, previousToken: token);
case IfStatementSyntax ifStatement: return InferTypeInIfStatement(ifStatement, token);
case ImplicitArrayCreationExpressionSyntax implicitArray: return InferTypeInImplicitArrayCreation(implicitArray, token);
case InitializerExpressionSyntax initializerExpression: return InferTypeInInitializerExpression(initializerExpression, previousToken: token);
case LockStatementSyntax lockStatement: return InferTypeInLockStatement(lockStatement, token);
case MemberAccessExpressionSyntax memberAccessExpression: return InferTypeInMemberAccessExpression(memberAccessExpression, previousToken: token);
......@@ -1207,6 +1208,11 @@ private IEnumerable<TypeInferenceInfo> InferTypeInIfStatement(IfStatementSyntax
return SpecializedCollections.SingletonEnumerable(new TypeInferenceInfo(this.Compilation.GetSpecialType(SpecialType.System_Boolean)));
}
private IEnumerable<TypeInferenceInfo> InferTypeInImplicitArrayCreation(ImplicitArrayCreationExpressionSyntax implicitArray, SyntaxToken previousToken)
{
return InferTypes(implicitArray.SpanStart);
}
private IEnumerable<TypeInferenceInfo> InferTypeInInitializerExpression(
InitializerExpressionSyntax initializerExpression,
ExpressionSyntax expressionOpt = null,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册