classCompletionReduction
final class CompletionReduction
Eliminates independent subtrees using exact empty/non-empty costs instead of enumerating their derivations.
Methods§
public function __construct(
private CompletionCosts $costs,
private ConstraintDependencies $dependencies,
)Independent subtrees cannot consume any remaining pattern counter and therefore commute with the constrained walk.
Parameters
$costs | CompletionCosts | |
$dependencies | ConstraintDependencies |
public function reduce(
CompletionState $state,
GenerationPlan<bool> $plan,
CompletionFrontier $frontier,
): boolPreserves both output possibilities whenever the pending plan still requires a non-empty result.
Parameters
$state | CompletionState | |
$plan | GenerationPlan<bool> | |
$frontier | CompletionFrontier |
Returns
boolTest cases 1
Called from 1
Calls 5
- method-call ConstraintDependencies::affected() line 27
- method-call CompletionCosts::sequence() line 40
- method-call CompletionFrontier::offer() line 42
- static-call CompletionCosts::add() line 42
- function-call
minline 42
Private surface 2§
Implementation details, listed for orientation only.
private CompletionCosts $costsprivate ConstraintDependencies $dependenciesTest cases 20§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 19
BytePlanCompilerTestcallsPlanBuilderTestcallsCompletionMemoTestcallsConstrainedCompletionTestcallsConstraintDependenciesTestcallsDerivationTestcallsDerivationTraceTestcallsTokenGeneratorTestcallsLexemeSequenceTestcallsCandidateResolverTestcallsSqlGeneratorTestcallsTerminalSequenceTestcallsGenerationContextTestcallsMySqlProviderTestcallsGenerationContextTestcallsPostgreSqlProviderTestcallsSqlGeneratorFactoryTestcallsGenerationContextTestcallsSqliteProviderTestcalls