fix: tap with an ordinal + id-selector always misparsed (PT-26)#178
Merged
Conversation
The parser's ordinal-selector branch only checked for quoted text or a bare identifier after the ordinal, never an #id token - so "tap 1st #post_list_card" left "#post_list_card" completely unconsumed, and it misparsed as a second, stray, unknown recipe call. Fixed by accepting an id-selector after an ordinal too, preserving its "#" prefix in the selector's Text field. Since Flutter itself enforces unique Keys among direct siblings, disambiguating repeated same-id rows by position also required a matching fix on the Dart agent side: the "ordinal" selector kind was hardcoded to always match by displayed text, never by id - now it checks for the "#" prefix (matching the plain "id" selector kind's existing convention) and matches by key instead when present. Confirmed via a parser test (checked to fail against the pre-fix code, reproducing the exact reported error shape) and a Dart widget test (checked to fail against the pre-fix finder.dart), plus real-device verification: tapping "1st"/"2nd" against a real repeated list correctly lands on the 1st/2nd row respectively, not just "doesn't error."
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
The parser's ordinal-selector branch only checked for quoted text or a bare identifier after the ordinal, never an
#idtoken -- sotap 1st #post_list_cardleft#post_list_cardcompletely unconsumed, and it misparsed as a second, stray, unknown recipe call.Fixed by accepting an id-selector after an ordinal too, preserving its
#prefix in the selector'sTextfield.Since Flutter itself enforces unique
Keys among direct siblings, disambiguating repeated same-id rows by position also required a matching fix on the Dart agent side: theordinalselector kind was hardcoded to always match by displayed text, never by id -- now it checks for the#prefix (matching the plainidselector kind's existing convention) and matches by key instead when present.Test plan
go build ./...,go vet ./...,go test ./...all passstaticcheck ./...cleandart analyze lib/clean,flutter testall pass (34 tests, including 2 new: a parser test and a Dart widget test)Semantics.identifierto e2e-test-workspace's repeated list rows, confirmedtap 1st #idandtap 2nd #idcorrectly land on the 1st/2nd row respectively (not just "doesn't error" -- verified actual positional correctness), then reverted the temporary app change