Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix property parsing when it contains parantheses #48598

Merged
merged 11 commits into from
Nov 10, 2020
4 changes: 3 additions & 1 deletion src/Compilers/VisualBasic/Portable/Parser/Parser.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4186,7 +4186,9 @@ checkNullable:
' TODO - GreenSepList knows its error count. Expose it instead of recomputing it.
If propertyParameters.Count = 0 Then
Dim unexpected = ResyncAt({SyntaxKind.AsKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.EqualsToken})
closeParen = closeParen.AddTrailingSyntax(unexpected)
If unexpected.Count > 0 Then
closeParen = closeParen.AddTrailingSyntax(unexpected, ERRID.ERR_ExpectedEOS)
333fred marked this conversation as resolved.
Show resolved Hide resolved
Youssef1313 marked this conversation as resolved.
Show resolved Hide resolved
End If
End If

optionalParameters = SyntaxFactory.ParameterList(openParen, propertyParameters, closeParen)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,4 +934,17 @@ End Enum
Assert.Equal(Syntax.InternalSyntax.Scanner.BadTokenCountLimit, tree.GetDiagnostics().Where(Function(d) d.Code = ERRID.ERR_IllegalChar).Count())
End Sub

<Fact, WorkItem(48587, "https://github.com/dotnet/roslyn/issues/48587")>
Public Sub ParseTrailingTextAfterPropertyWithParentheses()
ParseAndVerify(<![CDATA[
Class C
Public ReadOnly Property NumberOfResult1() String Integer JohnDoe WwwIIWww Wow
Public ReadOnly Property NumberOfResult2() Some unexpected tokens As Integer
Youssef1313 marked this conversation as resolved.
Show resolved Hide resolved
End Class
]]>,
<errors>
<error id="30205"/>
Youssef1313 marked this conversation as resolved.
Show resolved Hide resolved
<error id="30205"/>
</errors>)
End Sub
End Class