mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
36 lines
811 B
Swift
36 lines
811 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// https://github.com/apple/swift/issues/55623
|
|
// Make sure we don't incorrectly split the constraint system without
|
|
// considering that a result builder type var may connect the inside of a
|
|
// closure body with the enclosing expression.
|
|
|
|
struct New<Value> {
|
|
init(value: Value, @ScopeBuilder<Value> scope: () -> Component) { }
|
|
}
|
|
|
|
struct Component {}
|
|
|
|
struct Map<Value, Transformed> {
|
|
let transform: (Value) -> Transformed
|
|
}
|
|
|
|
@resultBuilder
|
|
struct ScopeBuilder<Value> {
|
|
static func buildExpression<T>(_ map: Map<Value, T>) -> Component {
|
|
Component()
|
|
}
|
|
|
|
static func buildBlock(_ components: Component...) -> Component {
|
|
Component()
|
|
}
|
|
}
|
|
|
|
let new1 = New(value: 42) {
|
|
Map { $0.description }
|
|
}
|
|
|
|
let new2 = New<Int>(value: 42) {
|
|
Map { $0.description }
|
|
}
|