提交 66733d69 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #18654 from CyrusNajmabadi/asyncParsing

Improve parser error tolerance around parsing incomplete async members.
......@@ -1315,7 +1315,7 @@ private void ParseModifiers(SyntaxListBuilder tokens)
}
case SyntaxModifier.Async:
{
if (ShouldCurrentContextualKeywordBeTreatedAsModifier(parsingStatementNotDeclaration: false))
if (ShouldAsyncBeTreatedAsModifier(parsingStatementNotDeclaration: false))
{
modTok = ConvertToKeyword(this.EatToken());
modTok = CheckFeatureAvailability(modTok, MessageID.IDS_FeatureAsync);
......@@ -1337,14 +1337,13 @@ private void ParseModifiers(SyntaxListBuilder tokens)
}
}
private bool ShouldCurrentContextualKeywordBeTreatedAsModifier(bool parsingStatementNotDeclaration)
private bool ShouldAsyncBeTreatedAsModifier(bool parsingStatementNotDeclaration)
{
Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword);
// Adapted from CParser::IsAsyncMethod.
var nextToken = PeekToken(1);
if (GetModifier(nextToken) != SyntaxModifier.None && !SyntaxFacts.IsContextualKeyword(nextToken.ContextualKind))
if (IsNonContextualModifier(PeekToken(1)))
{
// If the next token is a (non-contextual) modifier keyword, then this token is
// definitely the async keyword
......@@ -1358,7 +1357,7 @@ private bool ShouldCurrentContextualKeywordBeTreatedAsModifier(bool parsingState
try
{
this.EatToken(); //move past contextual keyword
this.EatToken(); //move past contextual 'async'
if (!parsingStatementNotDeclaration &&
(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword))
......@@ -1389,11 +1388,62 @@ private bool ShouldCurrentContextualKeywordBeTreatedAsModifier(bool parsingState
if (ScanType() != ScanTypeFlags.NotType)
{
// We've seen "async TypeName". Now we have to determine if we should we treat
// 'async' as a modifier. Or is the user actually writing something like
// "public async Foo" where 'async' is actually the return type.
if (IsPossibleMemberName())
{
// we have: "async Type X" or "async Type this", 'async' is definitely a
// modifier here.
return true;
}
var currentTokenKind = this.CurrentToken.Kind;
// The file ends with "async TypeName", it's not legal code, and it's much
// more likely that this is meant to be a modifier.
if (currentTokenKind == SyntaxKind.EndOfFileToken)
{
return true;
}
// "async TypeName }". In this case, we just have an incomplete member, and
// we should definitely default to 'async' being considered a return type here.
if (currentTokenKind == SyntaxKind.CloseBraceToken)
{
return true;
}
// "async TypeName void". In this case, we just have an incomplete member before
// an existing member. Treat this 'async' as a keyword.
if (SyntaxFacts.IsPredefinedType(this.CurrentToken.Kind))
{
return true;
}
if (!parsingStatementNotDeclaration && this.CurrentToken.Kind == SyntaxKind.OperatorKeyword)
// "async TypeName public". In this case, we just have an incomplete member before
// an existing member. Treat this 'async' as a keyword.
if (IsNonContextualModifier(this.CurrentToken))
{
return true;
}
// "async TypeName class". In this case, we just have an incomplete member before
// an existing type declaration. Treat this 'async' as a keyword.
if (CanStartTypeDeclaration(this.CurrentToken.Kind))
{
return true;
}
// "async TypeName namespace". In this case, we just have an incomplete member before
// an existing namespace declaration. Treat this 'async' as a keyword.
if (currentTokenKind == SyntaxKind.NamespaceKeyword)
{
return true;
}
if (!parsingStatementNotDeclaration && currentTokenKind == SyntaxKind.OperatorKeyword)
{
return true;
}
......@@ -1408,6 +1458,11 @@ private bool ShouldCurrentContextualKeywordBeTreatedAsModifier(bool parsingState
return false;
}
private static bool IsNonContextualModifier(SyntaxToken nextToken)
{
return GetModifier(nextToken) != SyntaxModifier.None && !SyntaxFacts.IsContextualKeyword(nextToken.ContextualKind);
}
private void ReportDuplicateModifiers(ref SyntaxToken modTok, SyntaxModifier newMod, SyntaxModifier mods, ref bool seenNoDuplicates, ref bool seenNoAccessibilityDuplicates)
{
if ((mods & newMod) != 0)
......@@ -6710,7 +6765,7 @@ private bool IsPossibleLocalDeclarationStatement(bool allowAnyExpression)
tk = this.CurrentToken.ContextualKind;
if (IsAdditionalLocalFunctionModifier(tk) &&
(tk != SyntaxKind.AsyncKeyword || ShouldCurrentContextualKeywordBeTreatedAsModifier(parsingStatementNotDeclaration: true)))
(tk != SyntaxKind.AsyncKeyword || ShouldAsyncBeTreatedAsModifier(parsingStatementNotDeclaration: true)))
{
return true;
}
......
......@@ -384,7 +384,37 @@ async async
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void CompleteAsyncAsync1()
{
UsingTree(@"
class C
{
async async;
");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.FieldDeclaration);
{
......@@ -392,19 +422,65 @@ async async
{
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
N(SyntaxKind.VariableDeclarator);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.SemicolonToken);
N(SyntaxKind.SemicolonToken);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void CompleteAsyncAsync2()
{
UsingTree(@"
class C
{
async async = 1;
");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.FieldDeclaration);
{
N(SyntaxKind.VariableDeclaration);
{
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "async");
}
N(SyntaxKind.VariableDeclarator);
{
N(SyntaxKind.IdentifierToken, "async");
N(SyntaxKind.EqualsValueClause);
{
N(SyntaxKind.EqualsToken);
N(SyntaxKind.NumericLiteralExpression);
{
N(SyntaxKind.NumericLiteralToken, "1");
}
}
}
}
N(SyntaxKind.SemicolonToken);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
......@@ -420,7 +496,38 @@ class C
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void CompleteAsyncAsyncAsync()
{
UsingTree(@"
class C
{
async async async;
");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.FieldDeclaration);
{
......@@ -429,19 +536,20 @@ class C
{
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
N(SyntaxKind.VariableDeclarator);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.SemicolonToken);
N(SyntaxKind.SemicolonToken);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
......@@ -457,7 +565,39 @@ class C
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void CompleteAsyncAsyncAsyncAsync()
{
UsingTree(@"
class C
{
async async async async;
");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.FieldDeclaration);
{
......@@ -467,19 +607,20 @@ class C
{
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
N(SyntaxKind.VariableDeclarator);
{
N(SyntaxKind.IdentifierToken);
N(SyntaxKind.IdentifierToken, "async");
}
}
M(SyntaxKind.SemicolonToken);
N(SyntaxKind.SemicolonToken);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[WorkItem(609912, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/609912")]
......@@ -1305,5 +1446,257 @@ class C
");
Check(SyntaxKind.IndexerDeclaration);
}
[Fact]
public void AsyncTypeEndOfFile()
{
UsingTree("class C { async T");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void AsyncTypeCloseCurly()
{
UsingTree("class C { async T }");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
N(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void AsyncTypePredefinedType()
{
UsingTree(
@"class C {
async T
int");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.PredefinedType);
{
N(SyntaxKind.IntKeyword);
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void AsyncTypeModifier()
{
UsingTree(
@"class C {
async T
public");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.PublicKeyword);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void AsyncTypeFollowedByTypeDecl()
{
UsingTree(
@"class C {
async T
class");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
M(SyntaxKind.IdentifierToken);
M(SyntaxKind.OpenBraceToken);
M(SyntaxKind.CloseBraceToken);
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact]
public void AsyncTypeFollowedByNamespaceDecl()
{
UsingTree(
@"class C {
async T
namespace");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "C");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "T");
}
}
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.NamespaceDeclaration);
{
N(SyntaxKind.NamespaceKeyword);
M(SyntaxKind.IdentifierName);
{
M(SyntaxKind.IdentifierToken);
}
M(SyntaxKind.OpenBraceToken);
M(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
[Fact, WorkItem(18621, "https://github.com/dotnet/roslyn/issues/18621")]
public void AsyncGenericType()
{
UsingTree(
@"class Program
{
public async Task<IReadOnlyCollection<ProjectConfiguration>>
}");
N(SyntaxKind.CompilationUnit);
{
N(SyntaxKind.ClassDeclaration);
{
N(SyntaxKind.ClassKeyword);
N(SyntaxKind.IdentifierToken, "Program");
N(SyntaxKind.OpenBraceToken);
N(SyntaxKind.IncompleteMember);
{
N(SyntaxKind.PublicKeyword);
N(SyntaxKind.AsyncKeyword);
N(SyntaxKind.GenericName);
{
N(SyntaxKind.IdentifierToken, "Task");
N(SyntaxKind.TypeArgumentList);
{
N(SyntaxKind.LessThanToken);
N(SyntaxKind.GenericName);
{
N(SyntaxKind.IdentifierToken, "IReadOnlyCollection");
N(SyntaxKind.TypeArgumentList);
{
N(SyntaxKind.LessThanToken);
N(SyntaxKind.IdentifierName);
{
N(SyntaxKind.IdentifierToken, "ProjectConfiguration");
}
N(SyntaxKind.GreaterThanToken);
}
}
N(SyntaxKind.GreaterThanToken);
}
}
}
N(SyntaxKind.CloseBraceToken);
}
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
}
}
}
\ No newline at end of file
......@@ -58,4 +58,4 @@ internal string GetDebuggerDisplay()
return (Generation > 0) ? $"{Ordinal}#{Generation}" : Ordinal.ToString();
}
}
}
}
\ No newline at end of file
......@@ -9,11 +9,12 @@
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddUsing
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
{
public partial class AddUsingTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
......
......@@ -7,11 +7,12 @@
using Microsoft.CodeAnalysis.CSharp.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics;
using Microsoft.CodeAnalysis.Options;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddUsing
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
{
public partial class AddUsingTestsWithAddImportDiagnosticProvider : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
{
......@@ -240,5 +241,49 @@ class Class
{
List<Y x; }");
}
[WorkItem(18621, "https://github.com/dotnet/roslyn/issues/18621")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
public async Task TestIncompleteMemberWithAsyncTaskReturnType()
{
await TestInRegularAndScriptAsync(
@"
using System.Collections.Generic;
using System.Threading.Tasks;
namespace X
{
class ProjectConfiguration
{
}
}
namespace ConsoleApp282
{
class Program
{
public async Task<IReadOnlyCollection<[|ProjectConfiguration|]>>
}
}",
@"
using System.Collections.Generic;
using System.Threading.Tasks;
using X;
namespace X
{
class ProjectConfiguration
{
}
}
namespace ConsoleApp282
{
class Program
{
public async Task<IReadOnlyCollection<ProjectConfiguration>>
}
}");
}
}
}
\ No newline at end of file
......@@ -4,9 +4,9 @@
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddUsing
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
{
public partial class AddUsingTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
public partial class AddUsingTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
public async Task TestWhereExtension()
......
......@@ -16,7 +16,7 @@
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddUsing
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
{
using FixProviderData = Tuple<IPackageInstallerService, ISymbolSearchService>;
......
......@@ -4,9 +4,9 @@
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.AddUsing
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.AddUsing
{
public partial class AddUsingTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
public partial class AddUsingTests
{
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddImport)]
public async Task TestSimpleQuery()
......
......@@ -167,7 +167,7 @@
<Compile Include="AddBraces\AddBracesTests.cs" />
<Compile Include="Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProviderTests.cs" />
<Compile Include="Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProviderTests.cs" />
<Compile Include="Diagnostics\AddUsing\AddUsingTestsWithAddImportDiagnosticProvider.cs" />
<Compile Include="AddUsing\AddUsingTestsWithAddImportDiagnosticProvider.cs" />
<Compile Include="InitializeParameter\AddParameterCheckTests.cs" />
<Compile Include="AddParameter\AddParameterTests.cs" />
<Compile Include="AutomaticCompletion\AutomaticBraceCompletionTests.cs" />
......@@ -225,7 +225,7 @@
<Compile Include="CodeActions\ReplacePropertyWithMethods\ReplacePropertyWithMethodsTests.cs" />
<Compile Include="CodeLens\CSharpCodeLensTests.cs" />
<Compile Include="Completion\CompletionServiceTests.cs" />
<Compile Include="Diagnostics\AddUsing\AddUsingTests_NuGet.cs" />
<Compile Include="AddUsing\AddUsingTests_NuGet.cs" />
<Compile Include="Diagnostics\GenerateMethod\GenerateConversionTests.cs" />
<Compile Include="Diagnostics\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessTests_FixAllTests.cs" />
<Compile Include="Diagnostics\MakeMethodSynchronous\MakeMethodSynchronousTests.cs" />
......@@ -281,9 +281,9 @@
<Compile Include="DocumentationComments\CodeFixes\RemoveDocCommentNodeCodeFixProviderTests.cs" />
<Compile Include="GoToAdjacentMember\CSharpGoToAdjacentMemberTests.cs" />
<Compile Include="Diagnostics\AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest.cs" />
<Compile Include="Diagnostics\AddUsing\AddUsingTests.cs" />
<Compile Include="Diagnostics\AddUsing\AddUsingTests_ExtensionMethods.cs" />
<Compile Include="Diagnostics\AddUsing\AddUsingTests_Queries.cs" />
<Compile Include="AddUsing\AddUsingTests.cs" />
<Compile Include="AddUsing\AddUsingTests_ExtensionMethods.cs" />
<Compile Include="AddUsing\AddUsingTests_Queries.cs" />
<Compile Include="Diagnostics\MakeMethodAsynchronous\MakeMethodAsynchronousTests.cs" />
<Compile Include="Diagnostics\Async\AddAwaitTests.cs" />
<Compile Include="Diagnostics\Async\ChangeToAsyncTests.cs" />
......
......@@ -344,14 +344,13 @@ class C
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
public async void ModifierExclusion7()
{
// Note that the async is not included in the incomplete member syntax
var markup = @"
class C
{
async int $$
}
";
await VerifySymbolKinds(markup, SymbolKind.Field, SymbolKind.Method, SymbolKind.Property);
await VerifySymbolKinds(markup, SymbolKind.Method);
}
[Fact, Trait(Traits.Feature, Traits.Features.Completion)]
......
......@@ -267,7 +267,9 @@ private static ImmutableArray<SymbolKind> GetPossibleDeclarations(DeclarationMod
if (modifiers.IsAsync || modifiers.IsPartial)
{
// Fields and properties cannot be async or partial.
possibleTypes = possibleTypes.Remove(SymbolKind.Property);
possibleTypes = possibleTypes.Remove(SymbolKind.Field);
}
return possibleTypes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册