Repository navigation
Commit 77badfd
Do not expand optional-key shapes into every variant before loop widening
MutatingScope::generalizeType() flattened both sides with
TypeUtils::flattenTypes(), which turns a constant array with N optional
keys into its 2^N concrete variants (four lossy representatives above ten)
- only for the union right after to merge them back into the same shape,
paying the pairwise reduceArrays() pass for hundreds of variants on every
loop iteration. A method building a shape from a dozen conditional writes
spent 1.8 s there. The per-key widening reads keys, values and optionality
straight from the shape, so only unions are split now.
The bug-13637 fixture keeps the loop's int<0, 8> bound on the middle key
(the comment had called the previous `int` a residual) and describes the
innermost level as the optional-key shape it is.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfQHLTyyoMfjfa4sXJCGa51 parent 36170ac commit 77badfd
2 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5006 | 5006 | | |
5007 | 5007 | | |
5008 | 5008 | | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
| 5020 | + | |
| 5021 | + | |
| 5022 | + | |
| 5023 | + | |
| 5024 | + | |
| 5025 | + | |
| 5026 | + | |
| 5027 | + | |
| 5028 | + | |
| 5029 | + | |
| 5030 | + | |
| 5031 | + | |
| 5032 | + | |
| 5033 | + | |
5009 | 5034 | | |
5010 | 5035 | | |
5011 | 5036 | | |
| |||
5033 | 5058 | | |
5034 | 5059 | | |
5035 | 5060 | | |
5036 | | - | |
5037 | | - | |
| 5061 | + | |
| 5062 | + | |
5038 | 5063 | | |
5039 | 5064 | | |
5040 | 5065 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
0 commit comments