Skip to content

Commit 548ff3a

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

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/ModuleInterface/Observable.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// REQUIRES: swift_swift_parser
7+
8+
import _Observation
9+
10+
// CHECK-NOT: @Observable
11+
// CHECK-NOT: @ObservationIgnored
12+
// CHECK-NOT: @ObservationTracked
13+
14+
@Observable
15+
public class SomeClass {
16+
public var field = 3
17+
@ObservationIgnored public var ignored = 4
18+
}
19+
20+
public func requiresObservable<T: Observable>(_: T) { }
21+
22+
@inlinable func useObservable(sc: SomeClass) {
23+
requiresObservable(sc)
24+
}

0 commit comments

Comments
 (0)