From 694ff616eaa3696d62d2c423b6f24f159452623d Mon Sep 17 00:00:00 2001 From: Glenn Watson <5834289+glennawatson@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:37:31 +1000 Subject: [PATCH] refactor(generator): read the collapse rule from the one place that states it - InvokeCommand spelled the condition itself rather than asking the feature snapshot, which is the duplicate the shared property exists to remove. --- .../CodeGeneration/InvokeCommandCodeGenerator.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ReactiveUI.Binding.SourceGenerators/CodeGeneration/InvokeCommandCodeGenerator.cs b/src/ReactiveUI.Binding.SourceGenerators/CodeGeneration/InvokeCommandCodeGenerator.cs index b604193..95fd695 100644 --- a/src/ReactiveUI.Binding.SourceGenerators/CodeGeneration/InvokeCommandCodeGenerator.cs +++ b/src/ReactiveUI.Binding.SourceGenerators/CodeGeneration/InvokeCommandCodeGenerator.cs @@ -100,10 +100,8 @@ internal static List GroupByTypeSignature( /// The consumer compilation's language-feature snapshot. /// /// Call sites spelling the same selector reach the same worker, so the worker is keyed by the target type and - /// that text rather than by the call site. Under expression-text dispatch their branches are identical too, - /// and all but the first would be unreachable, so the group is collapsed to one call site per distinct - /// selector. Interception claims each call site by name, so nothing is collapsed there: a dropped call site - /// would carry no attribute and lose its generated invocation. + /// that text rather than by the call site. Whether the group also collapses to one of those call sites is the + /// snapshot's to say, because every API answers it the same way. /// private static void EmitGroup( StringBuilder sb, @@ -111,8 +109,7 @@ private static void EmitGroup( ImmutableArray allClasses, in LanguageFeatures features) { - var collapsible = features.SupportsCallerArgExpr && !features.SupportsInterceptors; - var emitted = collapsible + var emitted = features.CollapsesIndistinguishableCallSites ? group with { Invocations = CodeGeneratorHelpers.CollapseIndistinguishableCallSites(