From bfae7f98d60d9eb99a6b9053c0a4d2c7a304afa4 Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Fri, 3 Feb 2023 02:35:35 +0200 Subject: [PATCH] Record added node output states as new (#61575) --- .../CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs | 4 ++-- .../Core/Portable/SourceGeneration/Nodes/NodeStateTable.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs b/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs index c9e4dd31f1fbc..09e864fef00cf 100644 --- a/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs @@ -967,7 +967,7 @@ public void Modified_Entry_Adding_Outputs_Records_Added_Step_State() values = ImmutableArray.Create(1, 2, 3); - // second time we'll see that the "Input" step is modified, but the outputs of the "SelectMany" step are modified. + // second time we'll see that the "Input" step is modified, but the outputs of the "SelectMany" step are new. dstBuilder = GetBuilder(dstBuilder.ToImmutable(), trackIncrementalGeneratorSteps: true); var table = dstBuilder.GetLatestStateTableForNode(transformNode); @@ -979,7 +979,7 @@ public void Modified_Entry_Adding_Outputs_Records_Added_Step_State() Assert.All(step.Outputs, output => { - Assert.Equal(IncrementalStepRunReason.Modified, output.Reason); + Assert.Equal(IncrementalStepRunReason.New, output.Reason); }); } diff --git a/src/Compilers/Core/Portable/SourceGeneration/Nodes/NodeStateTable.cs b/src/Compilers/Core/Portable/SourceGeneration/Nodes/NodeStateTable.cs index 0c51983f2807f..6ab50c1c8784f 100644 --- a/src/Compilers/Core/Portable/SourceGeneration/Nodes/NodeStateTable.cs +++ b/src/Compilers/Core/Portable/SourceGeneration/Nodes/NodeStateTable.cs @@ -406,7 +406,7 @@ private static IncrementalStepRunReason AsStepState(EntryState inputState, Entry (EntryState.Cached, EntryState.Cached) => IncrementalStepRunReason.Cached, (EntryState.Removed, EntryState.Removed) => IncrementalStepRunReason.Removed, (EntryState.Modified, EntryState.Removed) => IncrementalStepRunReason.Removed, - (EntryState.Modified, EntryState.Added) => IncrementalStepRunReason.Modified, + (EntryState.Modified, EntryState.Added) => IncrementalStepRunReason.New, _ => throw ExceptionUtilities.UnexpectedValue((inputState, outputState)) }; }