mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
41 lines
611 B
Swift
41 lines
611 B
Swift
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx10.15 -emit-sil -verify
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: OS=macosx
|
|
|
|
import SwiftUI
|
|
import Combine
|
|
|
|
struct A: View {
|
|
var body: some View {
|
|
Spacer()
|
|
}
|
|
}
|
|
|
|
struct B: View {
|
|
var body: some View {
|
|
Spacer()
|
|
}
|
|
}
|
|
|
|
class Context: ObservableObject {
|
|
@State var flag: Bool
|
|
|
|
init() {
|
|
self.flag = false
|
|
}
|
|
}
|
|
|
|
struct S : View {
|
|
@EnvironmentObject var context: Context
|
|
|
|
var body: some View {
|
|
VStack {
|
|
if (context.flag) { // Ok (shouldn't trip SIL Verifier)
|
|
A()
|
|
} else {
|
|
B()
|
|
}
|
|
}
|
|
}
|
|
}
|