Handle single-node branches in ExtractCommonPrefixNode#34
Closed
danmoseley wants to merge 2 commits intomainfrom
Closed
Handle single-node branches in ExtractCommonPrefixNode#34danmoseley wants to merge 2 commits intomainfrom
danmoseley wants to merge 2 commits intomainfrom
Conversation
When alternation branches are reduced to single nodes (e.g., Set[Pp] from a single-child Concatenation after prior prefix extraction), ExtractCommonPrefixNode previously bailed because it required all branches to be Concatenations. This caused IgnoreCase alternation prefix extraction to stop one character short (e.g., 'htt' instead of 'http' for (http|https)). Fix: remove the upfront gate check, and handle both Concatenation and single-node branches throughout the extraction loop. Fixes dotnet#124871 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Behavioral correctness test for (?:http|https)://foo with IgnoreCase - 4-branch regression test exercising single-node branch after recursive prefix extraction - Non-IgnoreCase Set-node branch test via character class alternation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Owner
Author
|
Moved to dotnet#124881 |
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.
When alternation branches are reduced to single nodes (e.g.,
Set[Pp]from a single-child Concatenation after prior prefix extraction),ExtractCommonPrefixNodepreviously bailed because it required all branches to be Concatenations. This caused IgnoreCase alternation prefix extraction to stop one character short (e.g.,httinstead ofhttpfor(http|https)).Fix: Remove the upfront gate check and handle both Concatenation and single-node branches throughout the extraction loop. When a single-node branch matches the common prefix, it is replaced with Empty.
Fixes dotnet#124871
Tests: 7 new test cases covering http/https IC, shorter-branch-is-prefix, multi-char difference, 3-branch variants, and case-sensitive regression guard.