Files
swift-mirror/validation-test/Sema/SwiftUI/rdar58972627.swift
Pavel Yaskevich 6d671020b9 [TypeChecker/BuilderTransform] Make sure implicit load expression updates types in AST
Can't use `ConstraintSystem::addImplicitLoadExpr` because that would
only cache types in constraint system and wouldn't propagate them to AST,
since that happens in `ExprRewritter::finalize` during regular solution
application. `TypeChecker::addImplicitLoadExpr` should be used directly
in cases like that.

Resolves: rdar://problem/58972627
2020-02-03 11:45:55 -08:00

41 lines
606 B
Swift

// RUN: %target-swift-frontend %s -target x86_64-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()
}
}
}
}