Skip to content

Recognize setter symbols before statement modifiers - #402

Merged
284km merged 2 commits into
mainfrom
codex-parse-symbol-setter-indent
Nov 28, 2026
Merged

284km merged 2 commits into
mainfrom
codex-parse-symbol-setter-indent

Conversation

@284km

@284km 284km commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Valid bare setter symbols such as undef_method :line= if method_defined?(:line=) were mistaken for assignment before a statement modifier, corrupting the scope stack and producing false indentation warnings. Recognize the symbol using existing colon rules and encoded-name boundaries. This removes the Nokogiri warning that blocked ActionMailer startup.

Local validation against clean tools/ref_ruby.sh4.0.10/a704b7cd95,Prism1.8.2:

  • Corpus996: evaluator/VM × Hash index ON/OFF × normalGC/GC32, main and require, UTF8/Windows31J/Big5. Real indentation errors still warn; assignment/setter/ternary/eval controls pass.
  • run_corpus.sh --both:1036/1036; VM1036/0fallback/0FAIL/0list differences.12 source gates and default hygiene pass.
  • Complete test_parse, test_syntax, test_m17n, test_m17n_comb, test_mixed_unicode_escapes, test_pattern_matching versus mainc576 on both engines: no prior PASS lost. Existing test_parse3E/2VM failures and skips/assertion-count differences retained.
  • Instructions retired, median of3 alternating pairs: real test_parse-0.234%E/-0.365%VM;500setter classes-0.023%/-0.086%. Startup included.
  • Fixedseed12345 test_parse maxRSS,3pairs: evaluator median306048→290416KiB (ranges267536–344032 vs274560–328576); VM308576→336800 (291504–342896 vs298848–341712). Ranges overlap; no stable memory improvement claimed. An initial baseline test_syntax inner timeout is retained separately.
  • Full ActionMailer17 files on separate integration85d7500b (6183e24 + only this fix), fresh native gems from that binary, seed12345/jobs2/600s/2GiB: before and after0MATCH/268MISSING, all17 referenceCOMPLETE/all17 MereINCOMPLETE on both engines. The Nokogiri warning is fixed, but loading now stops at the next Class#subclasses super-lookup gap. No bound hit; this is not a passing Rails claim. Complete per-file states, times, provenance and limitations are in the record.

The pure PR runtime is c6bb8f1, O2 compiler9dec2ff6/mgz661a01d8. The separate Mailer integration includes reviewed unmerged#395/#399 fixes and is explicitly distinguished. Interrupted pre-pause runs remain incomplete. No VM/CAPI implementation changes; the pre-existing VM encoded-attr_accessor gap is outside this fix. Global merge holds remain.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head e62ba7a8 (m_parse.mere +19 in lvt_stmt_start, corpus 996, record).

  • A named setter Symbol (:line=) before a statement modifier is now treated as the end of a value instead of an assignment, so no extra if/loop scope is pushed and the false "mismatched indentations" warning is gone.
  • The recognition reuses the existing colon rules: colon_opens_sym/colon_cmd_head, and not after a spaced keyword or a value. It also requires :: not to precede, scan_ident to end exactly at the =, and the name to start alphabetic. So A::B = 1, h[:a] = 1 and ternary : forms keep their current behaviour. The author lists assignment/setter/ternary/eval controls.
  • For non-UTF-8 sources, the start is found by walking back to the colon or whitespace and then validating forwards with scan_ident. That handles ASCII trail bytes (Windows-31J/Big5) as the corpus exercises.
  • Corpus 996 covers if/unless/while/until modifiers, direct and require modes, three encodings under -w, and a real indentation mistake that must still warn.
  • No prior pass lost in the listed CRuby parser files. Instruction cost is neutral or slightly lower.

No findings from me. The merge waits for the automated reviewer on this head.

@284km
284km merged commit db5486c into main Nov 28, 2026
26 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant