Skip to content

Commit f4c45e8

Browse files
committed
[Type check diagnostics] Add already-fixed test case from rdar://problem/56710317.
Ensures that we don't regress diagnostics for this case in the future.
1 parent 1cd5152 commit f4c45e8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
2+
// REQUIRES: objc_interop
3+
4+
import SwiftUI
5+
import Combine
6+
7+
final class MyObservableObject: ObservableObject {
8+
@Published private(set) var isDoingTheThing = false
9+
}
10+
11+
struct MyView: View {
12+
@EnvironmentObject var observableObject: MyObservableObject
13+
14+
var body: some View {
15+
MyBindingView(doTheThing: $observableObject.isDoingTheThing) // expected-error{{cannot assign to property: 'isDoingTheThing' setter is inaccessible}}
16+
}
17+
}
18+
19+
struct MyBindingView: View {
20+
@Binding var doTheThing: Bool
21+
22+
var body: some View {
23+
Text(doTheThing ? "Doing The Thing" : "Doing Sweet Nothing")
24+
}
25+
}

0 commit comments

Comments
 (0)