Skip to content

Commit e0d62e9

Browse files
committed
[Test] Ensure that a class using the Observable macro builds a proper interface
1 parent 4184714 commit e0d62e9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/ModuleInterface/Observable.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -plugin-path %swift-host-lib-dir/plugins -disable-availability-checking
3+
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -module-name Library -disable-availability-checking
4+
// RUN: %FileCheck %s < %t/Library.swiftinterface
5+
6+
import _Observation
7+
8+
// CHECK-NOT: @Observable
9+
// CHECK-NOT: @ObservationIgnored
10+
// CHECK-NOT: @ObservationTracked
11+
12+
@Observable
13+
public class SomeClass {
14+
public var field = 3
15+
@ObservationIgnored public var ignored = 4
16+
}
17+
18+
public func requiresObservable<T: Observable>(_: T) { }
19+
20+
@inlinable func useObservable(sc: SomeClass) {
21+
requiresObservable(sc)
22+
}

0 commit comments

Comments
 (0)