diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs index cb5d99d4602b3..1786887ab08cc 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/AbstractFlowPass.cs @@ -3043,7 +3043,7 @@ public override BoundNode VisitLoweredIsPatternExpression(BoundLoweredIsPatternE { var savedState = this.State.Clone(); VisitStatements(node.Statements); - this.State = savedState; + SetState(savedState); return null; } diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IsPatternOperator.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IsPatternOperator.cs index 00cbbd7362677..ad9a07be340bc 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IsPatternOperator.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IsPatternOperator.cs @@ -121,16 +121,13 @@ internal BoundExpression LowerGeneralIsPattern(BoundIsPatternExpression node, Bo // lower the decision dag. ImmutableArray loweredDag = LowerDecisionDagCore(decisionDag); - var resultBuilder = ArrayBuilder.GetInstance(loweredDag.Length + _statements.Count); - resultBuilder.AddRange(loweredDag); - resultBuilder.AddRange(_statements); return _factory.Sequence( _tempAllocator.AllTemps(), sideEffectsBuilder.ToImmutableAndFree(), new BoundLoweredIsPatternExpression( node.Syntax, // Note: it is not expected for this node to trigger spilling - resultBuilder.ToImmutableAndFree(), + loweredDag.AddRange(_statements), node.WhenTrueLabel, node.WhenFalseLabel, node.Type));