Commit 918c3e3
aver: handle
Both `stripped.endswith("]")` checks in _strip_module_effects were
brittle to Aver's trailing line comments (`// ...`). For an LLM-emitted
declaration like:
effects [Console.print] // pure module
the strip pass would:
1. match the opener regex (correctly)
2. fail `endswith("]")` because the line ends in `e` (`pure`)
3. enter `skip_until_close` mode
4. chew through subsequent lines until something happens to end
in `]` — likely catastrophic for the function body
Same hazard on the closing line of a multi-line list:
effects [
Console.print,
] // pure module
Replace both `endswith("]")` checks with `"]" in stripped`. Module-level
effect lists are simple identifier sequences with no string literals or
nested brackets, so the theoretical false-match concern (a `]` inside a
string in the list) doesn't apply now or in any planned Aver evolution.
Tests:
- `test_strips_inline_effects_with_trailing_comment` — the inline
variant; asserts the function body is intact (i.e. NOT eaten by a
runaway skip_until_close).
- `test_strips_multiline_effects_with_trailing_comment_on_close` — same
hazard on the closing line of a multi-line list.
Both new tests pass; full `tests/test_runner.py` suite green
(106 passed locally).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>] followed by trailing comment in module-effects strip1 parent 661a0b7 commit 918c3e3
2 files changed
Lines changed: 54 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
986 | 986 | | |
987 | 987 | | |
988 | 988 | | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
989 | 1033 | | |
990 | 1034 | | |
991 | 1035 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | | - | |
600 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
601 | 604 | | |
602 | 605 | | |
603 | 606 | | |
| |||
622 | 625 | | |
623 | 626 | | |
624 | 627 | | |
625 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
626 | 633 | | |
627 | 634 | | |
628 | 635 | | |
| |||
0 commit comments