fix: add regression tests for ternary label false positives - #427
Draft
toddr-bot wants to merge 1 commit into
Draft
fix: add regression tests for ternary label false positives#427toddr-bot wants to merge 1 commit into
toddr-bot wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds regression test coverage for the exact patterns reported in GH #62: bareword
undef,Class->method, and$obj->methodin 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
t/data/08_regression/52_ternary_label_false_positive.codewith the three issue patterns.dumpfile with expected parse outputt/08_regression.tandt/25_increment.tTest plan
undefasPPI::Token::Word,methodasPPI::Token::Word,:asPPI::Token::OperatorGenerated 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