Skip to content

fix: add regression tests for ternary label false positives - #427

Draft
toddr-bot wants to merge 1 commit into
masterfrom
koan.toddr.bot/fix-issue-62
Draft

fix: add regression tests for ternary label false positives#427
toddr-bot wants to merge 1 commit into
masterfrom
koan.toddr.bot/fix-issue-62

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds regression test coverage for the exact patterns reported in GH #62: bareword undef, Class->method, and $obj->method in ternary expressions were misparsed as labels.

The code fix was already applied in f9b7279 (checking if the previous significant token is an operator before classifying a bareword as a label), but the specific patterns from the issue were not covered by the existing regression tests (49/50). This adds test case 52 with the three reported patterns.

Fixes #62

Changes

  • Add t/data/08_regression/52_ternary_label_false_positive.code with the three issue patterns
  • Add matching .dump file with expected parse output
  • Update test counts in t/08_regression.t and t/25_increment.t

Test plan

  • All 69 test files pass (53,557 tests)
  • Verified all three issue patterns parse correctly: undef as PPI::Token::Word, method as PPI::Token::Word, : as PPI::Token::Operator

Generated by Kōan /fix


Quality Report

Changes: 4 files changed, 58 insertions(+), 2 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Add test case 52 covering the exact patterns from the issue:
bareword `undef`, `Class->method`, and `$obj->method` in ternary
expressions were previously misparsed as labels.

The code fix (checking if previous significant token is an operator)
was applied in f9b7279 but the specific issue patterns were not
covered by the existing tests (49/50).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

RT 41170: When token before ":" in a ternary expression is a bareword, it's misparsed as a label

1 participant