Commit 64d23ab
linq_fold: PR E R1 — gate Array pass on no-bridge (Copilot #1)
Pre-existing latent bug surfaced by the PR E refactor. peel_each only
unwraps `each(<array>)`, so `extract_decs_bridge(top)` still succeeds
on a from_decs eager-bridge source after the Decs pass. If the Decs
pass cascaded (e.g. emit_group_by's non-primitive join-key bail at
linq_fold.das:4475), the Array pass would re-match the same decs-only
row (decs_source predicate stays true) and emit_group_by would take
its Array branch — silently dropping the upstream_join capture and
mis-splicing the chain.
Same shape existed in master (plan_decs_group_by stub cascaded ->
plan_group_by stub re-matched group_by_decs row with Array adapter).
Never exercised by tests because no in-tree fixture combines
from_decs + non-primitive-key join + group_by, but the path was real.
Fix: in try_splice_patterns, return null after the Decs pass when
bridge != null. Cascaded decs chains now fall through to tier-2
fold_linq_default — the safety net that materializes the bridge buffer
and re-runs the chain — instead of risking a wrong-adapter emission.
doc/source/reference/linq_fold_patterns.rst "How dispatch works":
restated pass 2 as "runs only when bridge == null", with the WHY
inline (peel_each leaves the eager bridge intact, so without the gate
decs_source predicates would still match in the Array pass).
Verification: 1689/1689 tests/linq + 9809/9815 full suite (same
baseline). No test changed result, confirming nothing was relying on
the bug-path emission.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 2ff10e2 commit 64d23ab
2 files changed
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6487 | 6487 | | |
6488 | 6488 | | |
6489 | 6489 | | |
| 6490 | + | |
| 6491 | + | |
6490 | 6492 | | |
6491 | 6493 | | |
6492 | 6494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
0 commit comments