'behavior' Parameter Passed In The Wrong Order in Regex Builder Refactoring
CodaFi opened this issue · 3 comments
CodaFi commented
In Xcode 14.1 beta 3, this regex
#/(.*?)/#Expands to this regex builder
Regex {
Capture {
ZeroOrMore(.reluctant, .any)
}
}Which fails to type check because ZeroOrMore takes the component first and the behavior second when not passed a trailing closure that produces a component.
milseman commented
CC @DaveEwing
Azoy commented
On main this get's printed as:
Regex {
Capture {
ZeroOrMore(.reluctant) {
/./
}
}
}with the comment that the DSL'S .any is not equivalent to /./. cc: @hamishknight
hamishknight commented
Yeah the . of a regex literal has different newline matching behavior to .any. However looks like this is still an issue for other elements, e.g on main /\d*?/ gets refactored to:
Regex {
ZeroOrMore(.reluctant, .digit)
}