mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Placeholder variable that represents result of `if` should be placed at the beginning of the statement, same goes for `Optional(.some(...))` that wraps the expression in "then" branch. Resolves: https://github.com/apple/swift/issues/62848
24 lines
464 B
Swift
24 lines
464 B
Swift
// RUN: %sourcekitd-test -req=collect-type %s -- %s
|
|
|
|
struct Rectangle {
|
|
init() {}
|
|
}
|
|
|
|
@resultBuilder public struct WiewBuilder {
|
|
public static func buildBlock<Content>(_ content: Content) -> Content {
|
|
return content
|
|
}
|
|
public static func buildIf<Content>(_ content: Content?) -> Content? {
|
|
return content
|
|
}
|
|
}
|
|
|
|
public struct AStack<Content> {
|
|
init(@WiewBuilder content: () -> Content) {}
|
|
}
|
|
|
|
func foo() {
|
|
AStack {
|
|
if true {
|
|
Rectangle()
|