You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make unary builder return Regex type consistently.
Currently, unary regex component builder simply forwards the component's base type. However, this is inconsistent with non-unary builder results. The current behavior may lead to surprising results when the user marks a property with `@RegexComponentBuilder`.
This patch makes `RegexComponentBuilder.buildPartialBlock<R>(first: R)` return a `Regex<R.RegexOutput>` rather than `R` itself.
---
Before:
```swift
// error: cannot convert value of type 'OneOrMore<Substring>' to specified type 'Regex<Substring>'
@RegexComponentBuilder
var r: Regex<Substring> {
OneOrMore("a")
// Adding other components below will make the error go away.
}
struct MyCustomRegex: RegexComponent {
// error: cannot convert value of type 'OneOrMore<Substring>' to specified type 'Regex<Substring>'
var regex: Regex<Substring> {
OneOrMore("a")
}
}
```
After: No errors.
0 commit comments