diff --git a/src/Compilers/VisualBasic/Portable/Parser/Parser.vb b/src/Compilers/VisualBasic/Portable/Parser/Parser.vb index f1f1ab8d26c8c..128f4e83f3794 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/Parser.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/Parser.vb @@ -4181,14 +4181,6 @@ checkNullable: If CurrentToken.Kind = SyntaxKind.OpenParenToken Then propertyParameters = ParseParameters(openParen, closeParen) - - ' If we blow up on the parameters try to resume on the AS, =, or Implements - ' 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) - End If - optionalParameters = SyntaxFactory.ParameterList(openParen, propertyParameters, closeParen) Else If ident.ContainsDiagnostics Then diff --git a/src/Compilers/VisualBasic/Test/Syntax/Parser/ParserRegressionTests.vb b/src/Compilers/VisualBasic/Test/Syntax/Parser/ParserRegressionTests.vb index 0ce46fbf1763e..e10774ec82a94 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/Parser/ParserRegressionTests.vb +++ b/src/Compilers/VisualBasic/Test/Syntax/Parser/ParserRegressionTests.vb @@ -934,4 +934,38 @@ End Enum Assert.Equal(Syntax.InternalSyntax.Scanner.BadTokenCountLimit, tree.GetDiagnostics().Where(Function(d) d.Code = ERRID.ERR_IllegalChar).Count()) End Sub + + Public Sub ParseTrailingTextAfterPropertyWithParentheses() + Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40( + + +Class C + Public ReadOnly Property NumberOfResult1() String Integer JohnDoe WwwIIWww Wow + Public ReadOnly Property NumberOfResult2() Some unexpected tokens As Integer + Public ReadOnly Property NumberOfResult3() UnexpectedToken ' With comment. + Public ReadOnly Property NumberOfResult4() UnexpectedToken _ + As Integer ' with line continuation and comment. + + Public ReadOnly Property NumberOfResult5() ' With comment - no errors. + Public ReadOnly Property NumberOfResult6() _ + As Integer ' No error with line continuation. +End Class + +) + CompilationUtils.AssertTheseDiagnostics(compilation, + +BC30205: End of statement expected. + Public ReadOnly Property NumberOfResult1() String Integer JohnDoe WwwIIWww Wow + ~~~~~~ +BC30205: End of statement expected. + Public ReadOnly Property NumberOfResult2() Some unexpected tokens As Integer + ~~~~ +BC30205: End of statement expected. + Public ReadOnly Property NumberOfResult3() UnexpectedToken ' With comment. + ~~~~~~~~~~~~~~~ +BC30205: End of statement expected. + Public ReadOnly Property NumberOfResult4() UnexpectedToken _ + ~~~~~~~~~~~~~~~ +) + End Sub End Class