From 4243988de42194b1515a66e72e56d32a1d2934da Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Thu, 10 Aug 2017 15:34:55 -0700 Subject: [PATCH] re-enabled assert we have disabled --- .../Portable/Binding/Binder_Expressions.vb | 6 +- .../Portable/Binding/Binder_Statements.vb | 58 ++++++++----------- 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb index 53e8b68e1d466..202fbee7d5766 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Expressions.vb @@ -251,11 +251,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' e.g. SyntaxKind.MidExpression is handled elsewhere ' NOTE: There were too many "else" cases to justify listing them explicitly and throwing on ' anything unexpected. - ' - ' PROTOTYPE(IOperation) - ' re-enable the assert once this issue is fixed - ' https://github.com/dotnet/roslyn/issues/21180 - ' Debug.Assert(node.ContainsDiagnostics, String.Format("Unexpected {0} syntax does not have diagnostics", node.Kind)) + Debug.Assert(IsSemanticModelBinder OrElse node.ContainsDiagnostics, String.Format("Unexpected {0} syntax does not have diagnostics", node.Kind)) Return BadExpression(node, ImmutableArray(Of BoundExpression).Empty, ErrorTypeSymbol.UnknownResultType) End Select diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb index 6ecf1aeebcd12..f58b851bd5394 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Statements.vb @@ -65,11 +65,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Case SyntaxKind.ElseIfStatement ' ElseIf without a preceding If. - ' - ' PROTOTYPE(IOperation) - ' re-enable the assert once this issue is fixed - ' https://github.com/dotnet/roslyn/issues/21180 - ' Debug.Assert(node.ContainsDiagnostics) + Debug.Assert(IsSemanticModelBinder OrElse node.ContainsDiagnostics) Dim condition = BindBooleanExpression(DirectCast(node, ElseIfStatementSyntax).Condition, diagnostics) Return New BoundBadStatement(node, ImmutableArray.Create(Of BoundNode)(condition), hasErrors:=True) @@ -200,31 +196,27 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' where only the ones that can appear in a method body have been selected). ' ' We simply need to ignore this, the error is already created by the parser. - ' - ' PROTOTYPE(IOperation) - ' re-enable the assert once this issue is fixed - ' https://github.com/dotnet/roslyn/issues/21180 - 'Debug.Assert(node.ContainsDiagnostics OrElse - ' (node.IsMissing AndAlso - ' (node.Parent.Kind = SyntaxKind.MultiLineSubLambdaExpression OrElse - ' node.Parent.Kind = SyntaxKind.MultiLineFunctionLambdaExpression OrElse - ' node.Parent.Kind = SyntaxKind.AddHandlerAccessorBlock OrElse - ' node.Parent.Kind = SyntaxKind.RemoveHandlerAccessorBlock OrElse - ' node.Parent.Kind = SyntaxKind.RaiseEventAccessorBlock OrElse - ' node.Parent.Kind = SyntaxKind.MultiLineIfBlock OrElse - ' node.Parent.Kind = SyntaxKind.ElseIfBlock OrElse - ' node.Parent.Kind = SyntaxKind.ElseBlock OrElse - ' node.Parent.Kind = SyntaxKind.SimpleDoLoopBlock OrElse - ' node.Parent.Kind = SyntaxKind.DoWhileLoopBlock OrElse - ' node.Parent.Kind = SyntaxKind.DoUntilLoopBlock OrElse - ' node.Parent.Kind = SyntaxKind.WhileBlock OrElse - ' node.Parent.Kind = SyntaxKind.WithBlock OrElse - ' node.Parent.Kind = SyntaxKind.ForBlock OrElse - ' node.Parent.Kind = SyntaxKind.ForEachBlock OrElse - ' node.Parent.Kind = SyntaxKind.SyncLockBlock OrElse - ' node.Parent.Kind = SyntaxKind.SelectBlock OrElse - ' node.Parent.Kind = SyntaxKind.TryBlock OrElse - ' node.Parent.Kind = SyntaxKind.UsingBlock))) + Debug.Assert(IsSemanticModelBinder OrElse node.ContainsDiagnostics OrElse + (node.IsMissing AndAlso + (node.Parent.Kind = SyntaxKind.MultiLineSubLambdaExpression OrElse + node.Parent.Kind = SyntaxKind.MultiLineFunctionLambdaExpression OrElse + node.Parent.Kind = SyntaxKind.AddHandlerAccessorBlock OrElse + node.Parent.Kind = SyntaxKind.RemoveHandlerAccessorBlock OrElse + node.Parent.Kind = SyntaxKind.RaiseEventAccessorBlock OrElse + node.Parent.Kind = SyntaxKind.MultiLineIfBlock OrElse + node.Parent.Kind = SyntaxKind.ElseIfBlock OrElse + node.Parent.Kind = SyntaxKind.ElseBlock OrElse + node.Parent.Kind = SyntaxKind.SimpleDoLoopBlock OrElse + node.Parent.Kind = SyntaxKind.DoWhileLoopBlock OrElse + node.Parent.Kind = SyntaxKind.DoUntilLoopBlock OrElse + node.Parent.Kind = SyntaxKind.WhileBlock OrElse + node.Parent.Kind = SyntaxKind.WithBlock OrElse + node.Parent.Kind = SyntaxKind.ForBlock OrElse + node.Parent.Kind = SyntaxKind.ForEachBlock OrElse + node.Parent.Kind = SyntaxKind.SyncLockBlock OrElse + node.Parent.Kind = SyntaxKind.SelectBlock OrElse + node.Parent.Kind = SyntaxKind.TryBlock OrElse + node.Parent.Kind = SyntaxKind.UsingBlock))) Return New BoundBadStatement(node, ImmutableArray(Of BoundNode).Empty, hasErrors:=True) @@ -272,11 +264,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' not handling here and then throwing ExceptionUtilities.UnexpectedValue in the else case, but ' there are just too many statement SyntaxKinds in VB (e.g. declarations, statements corresponding ' to blocks handled above, etc). - ' - ' PROTOTYPE(IOperation) - ' re-enable the assert once this issue is fixed - ' https://github.com/dotnet/roslyn/issues/21180 - ' Debug.Assert(node.ContainsDiagnostics) + Debug.Assert(IsSemanticModelBinder OrElse node.ContainsDiagnostics) Return New BoundBadStatement(node, ImmutableArray(Of BoundNode).Empty, hasErrors:=True) End Function