Skip to content

[Regex] Infer 'Match' type of regex literals. #40717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Dec 31, 2021

Applies swiftlang/swift-experimental-string-processing#68 in regex literal type inference. Regex literals with captures will have type Regex<Tuple{n}<Substring, {Captures...}>>. This is a temporary thing that allows us to define generic constraints on captures. We will switch back to native tuples once we have variadic generics.

@rxwei
Copy link
Contributor Author

rxwei commented Dec 31, 2021

@rxwei rxwei requested a review from milseman December 31, 2021 07:58
@rxwei
Copy link
Contributor Author

rxwei commented Dec 31, 2021

Note: This should not be merged until we have next tag (dev/5) in the string processing repo.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - db93ec98452e27c4356fdf6c8a4f5547eafcdec4

@rxwei
Copy link
Contributor Author

rxwei commented Jan 5, 2022

@swift-ci please test

@rxwei rxwei requested review from hamishknight and CodaFi January 5, 2022 21:47
Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically LGTM, but you might want another pair of eyes from the compiler team on it.

Applies swift-experimental-string-processing#68 in regex literal type inference. Regex literals with captures will have type `Regex<Tuple{n}<Substring, {Captures...}>>`. This is a temporary thing that allows us to define generic constraints on captures. We will switch back to native tuples once we have variadic generics.
@rxwei
Copy link
Contributor Author

rxwei commented Jan 6, 2022

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit 2cf8817 into swiftlang:main Jan 6, 2022
@rxwei rxwei deleted the regex-match branch January 6, 2022 22:37
@swift-ci
Copy link
Contributor

swift-ci commented Jan 7, 2022

Build failed
Swift Test OS X Platform
Git Sha - e5175d5

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.

4 participants