Skip to content

Conversation

natecook1000
Copy link
Member

When reconstructing the type of a captured element for access through the AnyRegexOutput.Element.type API, any optionality is being omitted (e.g. Int? is returned as Int). This is both observable through that API and results in a bug when accessing part of a match's output through the dynamic member subscript (e.g. match.1).

In that case, the lack of optionality causes an incorrect calculation of the output tuple member's position, resulting in the wrong member being loaded and returned.

This change adds the missing optionality to the type.

Fixes swiftlang/swift#83022. (rdar://155710126)

When reconstructing the type of a captured element for access through
the `AnyRegexOutput.Element.type` API, any optionality is being
omitted (e.g. `Int?` is returned as `Int`). This is both observable
through that API and results in a bug when accessing part of a
match's output through the dynamic member subscript (e.g. `match.1`).

In that case, the lack of optionality causes an incorrect calculation
of the output tuple member's position, resulting in the wrong member
being loaded and returned.

This change adds the missing optionality to the type.

Fixes swiftlang/swift#83022
@natecook1000 natecook1000 force-pushed the match-subscript-tuple-element branch from af6a199 to 7443f98 Compare September 17, 2025 16:49
@natecook1000
Copy link
Member Author

@swift-ci Please test Linux platform

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.

RegexBuilder: multiple Captures with transforms are clobbering each others' transformed values
1 participant