Skip to content

Commit 9cafbe5

Browse files
committed
Fix spelling mistake for ObservationRegistrar
1 parent 445c819 commit 9cafbe5

File tree

8 files changed

+30
-20
lines changed

8 files changed

+30
-20
lines changed

lib/Macros/Sources/ObservationMacros/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ add_library("${library_name}" SHARED
2121

2222
set_target_properties(${library_name}
2323
PROPERTIES
24-
PREFIX ""
25-
SUFFIX ".lib"
26-
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}"
27-
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}"
24+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}/plugins"
25+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}/plugins"
2826
)
2927

3028
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
@@ -89,5 +87,5 @@ swift_install_in_component(TARGETS "${library_name}"
8987
COMPONENT compiler)
9088

9189
swift_install_in_component(DIRECTORY "${module_base}"
92-
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}"
90+
DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}/plugins"
9391
COMPONENT compiler)

lib/Macros/Sources/ObservationMacros/ObservableMacro.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ private extension DeclSyntaxProtocol {
1717
}
1818
}
1919

20-
public struct ObservableMacro: MemberMacro, MemberAttributeMacro {
20+
public struct ObservableMacro: MemberMacro, MemberAttributeMacro, ConformanceMacro {
21+
// MARK: - ConformanceMacro
22+
public static func expansion<
23+
Declaration: DeclGroupSyntax,
24+
Context: MacroExpansionContext
25+
>(
26+
of node: AttributeSyntax,
27+
providingConformancesOf declaration: Declaration,
28+
in context: Context
29+
) throws -> [(TypeSyntax, GenericWhereClauseSyntax?)] {
30+
let protocolName: TypeSyntax = "Observable"
31+
return [(protocolName, nil)]
32+
}
2133

2234
// MARK: - MemberMacro
2335
public static func expansion(

stdlib/public/Observation/Sources/Observation/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ list(APPEND swift_runtime_library_compile_flags -I${SWIFT_SOURCE_DIR}/include)
1616

1717
list(APPEND SWIFT_OBSERVATION_SWIFT_FLAGS
1818
"-enable-experimental-feature" "Macros"
19-
"-load-plugin-library"
20-
${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARIES_SUBDIRECTORY}/ObservationMacros.lib)
19+
)
2120

2221
add_swift_target_library(swiftObservation ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
2322
KeyPaths.swift
2423
Locking.cpp
2524
Locking.swift
2625
Macros.swift
2726
Observable.swift
28-
ObservationRegistar.swift
27+
ObservationRegistrar.swift
2928
ObservationTracking.swift
3029
ObservedChanges.swift
3130
ObservedTransactions.swift

stdlib/public/Observation/Sources/Observation/Macros.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@available(SwiftStdlib 5.9, *)
1414
@attached(member)
1515
@attached(memberAttribute)
16+
@attached(conformance)
1617
public macro Observable() = #externalMacro(module: "ObservationMacros", type: "ObservableMacro")
1718

1819
@available(SwiftStdlib 5.9, *)

stdlib/public/Observation/Sources/Observation/ObservationRegistar.swift renamed to stdlib/public/Observation/Sources/Observation/ObservationRegistrar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import _Concurrency
1313

1414
@available(SwiftStdlib 5.9, *)
15-
public struct ObservationRegistar<Subject: Observable>: Sendable {
15+
public struct ObservationRegistrar<Subject: Observable>: Sendable {
1616
enum Phase {
1717
case willSet
1818
case didSet

stdlib/public/Observation/Sources/Observation/ObservationTracking.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct ObservationTracking {
1616
let remove: @Sendable (Int) -> Void
1717
var rawKeyPaths = Set<AnyKeyPath>()
1818

19-
init<Subject: Observable>(_ context: ObservationRegistar<Subject>.Context) {
19+
init<Subject: Observable>(_ context: ObservationRegistrar<Subject>.Context) {
2020
emit = { rawKeyPaths, observer in
2121
context.nextTracking(for: KeyPaths(raw: rawKeyPaths), observer)
2222
}
@@ -41,7 +41,7 @@ public struct ObservationTracking {
4141
struct AccessList {
4242
var entries = [ObjectIdentifier : Entry]()
4343

44-
mutating func addAccess<Subject: Observable>(keyPath: PartialKeyPath<Subject>, context: ObservationRegistar<Subject>.Context) {
44+
mutating func addAccess<Subject: Observable>(keyPath: PartialKeyPath<Subject>, context: ObservationRegistrar<Subject>.Context) {
4545
entries[context.id, default: Entry(context)].insert(keyPath)
4646
}
4747
}

stdlib/public/Observation/Sources/Observation/ObservedChanges.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import _Concurrency
1313

1414
@available(SwiftStdlib 5.9, *)
1515
public struct ObservedChanges<Subject: Observable, Element: Sendable> {
16-
let context: ObservationRegistar<Subject>.Context
16+
let context: ObservationRegistrar<Subject>.Context
1717
let keyPath: KeyPath<Subject, Element>
1818

19-
init(_ context: ObservationRegistar<Subject>.Context, keyPath: KeyPath<Subject, Element>) {
19+
init(_ context: ObservationRegistrar<Subject>.Context, keyPath: KeyPath<Subject, Element>) {
2020
self.context = context
2121
self.keyPath = keyPath
2222
}
@@ -25,11 +25,11 @@ public struct ObservedChanges<Subject: Observable, Element: Sendable> {
2525
@available(SwiftStdlib 5.9, *)
2626
extension ObservedChanges: AsyncSequence {
2727
public struct Iterator: AsyncIteratorProtocol {
28-
let context: ObservationRegistar<Subject>.Context
28+
let context: ObservationRegistrar<Subject>.Context
2929
let keyPath: KeyPath<Subject, Element>
3030
let keyPaths: KeyPaths<Subject>
3131

32-
init(_ context: ObservationRegistar<Subject>.Context, keyPath: KeyPath<Subject, Element>) {
32+
init(_ context: ObservationRegistrar<Subject>.Context, keyPath: KeyPath<Subject, Element>) {
3333
self.context = context
3434
self.keyPath = keyPath
3535
keyPaths = Subject.dependencies(of: keyPath)

stdlib/public/Observation/Sources/Observation/ObservedTransactions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import _Concurrency
1313

1414
@available(SwiftStdlib 5.9, *)
1515
public struct ObservedTransactions<Subject: Observable, Delivery: Actor> {
16-
let context: ObservationRegistar<Subject>.Context
16+
let context: ObservationRegistrar<Subject>.Context
1717
let keyPaths: KeyPaths<Subject>
1818
let isolation: Delivery
1919

20-
init(_ context: ObservationRegistar<Subject>.Context, keyPaths: KeyPaths<Subject>, isolation: Delivery) {
20+
init(_ context: ObservationRegistrar<Subject>.Context, keyPaths: KeyPaths<Subject>, isolation: Delivery) {
2121
self.context = context
2222
self.keyPaths = keyPaths
2323
self.isolation = isolation
@@ -29,11 +29,11 @@ extension ObservedTransactions: AsyncSequence {
2929
public typealias Element = KeyPaths<Subject>
3030

3131
public struct Iterator: AsyncIteratorProtocol {
32-
let context: ObservationRegistar<Subject>.Context
32+
let context: ObservationRegistrar<Subject>.Context
3333
let keyPaths: KeyPaths<Subject>
3434
let isolation: Delivery
3535

36-
init(_ context: ObservationRegistar<Subject>.Context, keyPaths: KeyPaths<Subject>, isolation: Delivery) {
36+
init(_ context: ObservationRegistrar<Subject>.Context, keyPaths: KeyPaths<Subject>, isolation: Delivery) {
3737
self.context = context
3838
self.keyPaths = keyPaths
3939
self.isolation = isolation

0 commit comments

Comments
 (0)