-
Notifications
You must be signed in to change notification settings - Fork 49
Use inits instead of as methods #448
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
Conversation
@swift-ci please test |
/// Use this initializer to create a strongly typed regex from | ||
/// one that was created from a string. Returns `nil` if the types | ||
/// don't match. | ||
public init?(_ dynamic: Regex<AnyRegexOutput>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like we should have an as: Output.Type = Output.self
parameter to match the run-time string-based initializer. e.g.
let pattern = "a+(b+)c+"
let a = try Regex(pattern, as: (Substring, Substring).self))
let b: Regex<(Substring, Substring)> = try Regex(pattern)
let dynamic = try Regex(pattern)
let c = Regex(dynamic, as: (Substring, Substring).self)!
let d: Regex<(Substring, Substring)> = Regex(dynamic)!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh that syntax highlighting. Any ideas for a better argument name than dynamic
?
@swift-ci please test |
Use inits instead of as methods Add ARO tests
No description provided.