Skip to content

Remove Regex.init<R: RegexComponent>(_: R). #234

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
Mar 29, 2022

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Mar 29, 2022

Regex.init<R: RegexComponent>(_: R) has existed as a way to convert any RegexComponent to a Regex. However, it is not super useful for the end user. More importantly, its existence seems to cause bad error messages in regex builder closures.

with-init

When this initializer is deleted, error messages become better and more localized. The user can still obtain a Regex from any RegexComponent just by calling the regex property.

without-init

`Regex.init<R: RegexComponent>(_: R)` has existed as a way to convert any `RegexComponent` to a `Regex`. However, it is not super useful for the end user. More importantly, its existence seems to cause bad error messages in regex builder closures.

When this initializer is deleted, error messages become better and more localized. The user can still obtain a `Regex` from any `RegexComponent` just by calling the `regex` property.
@rxwei rxwei requested a review from milseman March 29, 2022 21:13
@rxwei
Copy link
Contributor Author

rxwei commented Mar 29, 2022

@swift-ci please test

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.

LGTM

Also squashes potential ambiguity between a String as a quoted component vs compiled component.

@rxwei rxwei merged commit b9972b9 into swiftlang:main Mar 29, 2022
@rxwei rxwei deleted the remove-regex-init branch March 30, 2022 09:17
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.

2 participants