From 3a523c09be3005dd477c1c2e2fe3201f72d207cd Mon Sep 17 00:00:00 2001 From: Kyle Date: Sun, 5 May 2024 18:34:39 +0800 Subject: [PATCH] Fix Attribute.flags setter issue --- .../AttributeGraph.framework/Headers/AGAttributeFlags.h | 2 ++ .../arm64-apple-ios.swiftinterface | 7 +++++-- .../arm64e-apple-ios.swiftinterface | 7 +++++-- .../AttributeGraph.framework/Headers/AGAttributeFlags.h | 2 ++ .../arm64-apple-ios-simulator.swiftinterface | 7 +++++-- .../x86_64-apple-ios-simulator.swiftinterface | 7 +++++-- .../AttributeGraph.framework/Headers/AGAttributeFlags.h | 2 ++ .../arm64-apple-macos.swiftinterface | 7 +++++-- .../arm64e-apple-macos.swiftinterface | 7 +++++-- .../x86_64-apple-macos.swiftinterface | 7 +++++-- AG/Sources/Headers/AGAttributeFlags.h | 2 ++ .../AttributeGraph.swiftmodule/template.swiftinterface | 7 +++++-- Sources/OpenGraph/Attribute/Attribute/Attribute.swift | 4 ++-- Sources/_OpenGraph/Attribute/OGAttributeFlags.h | 2 ++ .../Attribute/Attribute/AttributeTests.swift | 7 +++++++ 15 files changed, 59 insertions(+), 18 deletions(-) diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeFlags.h b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeFlags.h index 806d9bb..65124c4 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeFlags.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Headers/AGAttributeFlags.h @@ -15,6 +15,8 @@ typedef AG_OPTIONS(uint32_t, AGAttributeFlags) { AGAttributeFlagsActive = 1 << 0, AGAttributeFlagsRemovable = 1 << 1, AGAttributeFlagsInvalidatable = 1 << 2, + + AGAttributeFlagsMask = 0xFF, }; #endif /* AGAttributeFlags_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface index 331560b..d21ce5a 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface index 331560b..d21ce5a 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-arm64e/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-ios.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeFlags.h b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeFlags.h index 806d9bb..65124c4 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeFlags.h +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Headers/AGAttributeFlags.h @@ -15,6 +15,8 @@ typedef AG_OPTIONS(uint32_t, AGAttributeFlags) { AGAttributeFlagsActive = 1 << 0, AGAttributeFlagsRemovable = 1 << 1, AGAttributeFlagsInvalidatable = 1 << 2, + + AGAttributeFlagsMask = 0xFF, }; #endif /* AGAttributeFlags_h */ diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface index bdab92e..9d52380 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-ios-simulator.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface index cec989d..d53a4e4 100644 --- a/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +++ b/AG/AttributeGraph.xcframework/ios-arm64-x86_64-simulator/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-ios-simulator.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeFlags.h b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeFlags.h index 806d9bb..65124c4 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeFlags.h +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Headers/AGAttributeFlags.h @@ -15,6 +15,8 @@ typedef AG_OPTIONS(uint32_t, AGAttributeFlags) { AGAttributeFlagsActive = 1 << 0, AGAttributeFlagsRemovable = 1 << 1, AGAttributeFlagsInvalidatable = 1 << 2, + + AGAttributeFlagsMask = 0xFF, }; #endif /* AGAttributeFlags_h */ diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface index c830933..a5b56f6 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64-apple-macos.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface index 46f600a..6cca96f 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/arm64e-apple-macos.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface index 5cc3acf..c6eda06 100644 --- a/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface +++ b/AG/AttributeGraph.xcframework/macos-arm64e-arm64-x86_64/AttributeGraph.framework/Modules/AttributeGraph.swiftmodule/x86_64-apple-macos.swiftinterface @@ -55,7 +55,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -85,7 +85,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/AG/Sources/Headers/AGAttributeFlags.h b/AG/Sources/Headers/AGAttributeFlags.h index 806d9bb..65124c4 100644 --- a/AG/Sources/Headers/AGAttributeFlags.h +++ b/AG/Sources/Headers/AGAttributeFlags.h @@ -15,6 +15,8 @@ typedef AG_OPTIONS(uint32_t, AGAttributeFlags) { AGAttributeFlagsActive = 1 << 0, AGAttributeFlagsRemovable = 1 << 1, AGAttributeFlagsInvalidatable = 1 << 2, + + AGAttributeFlagsMask = 0xFF, }; #endif /* AGAttributeFlags_h */ diff --git a/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface b/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface index 36f0142..2b64e25 100644 --- a/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface +++ b/AG/Sources/Modules/AttributeGraph.swiftmodule/template.swiftinterface @@ -51,7 +51,7 @@ public struct Attribute { unsafeAddress nonmutating set } - public var projectedValue: AttributeGraph.Attribute { get _modify } + public var projectedValue: AttributeGraph.Attribute { get set } public subscript(dynamicMember _: Swift.KeyPath) -> AttributeGraph.Attribute { get } public subscript(keyPath _: Swift.KeyPath) -> AttributeGraph.Attribute { get } @@ -81,7 +81,10 @@ public struct Attribute { public func addInput(_ attribute: AGAttribute, options: AGInputOptions = [], token: Swift.Int) public func addInput(_ attribute: AttributeGraph.Attribute, options: AGInputOptions = [], token: Int) - public var flags: AGAttributeFlags { get _modify } + public var flags: AGAttributeFlags { + get + nonmutating set + } public func setFlags(_ newFlags: AGAttributeFlags, mask: AGAttributeFlags) } diff --git a/Sources/OpenGraph/Attribute/Attribute/Attribute.swift b/Sources/OpenGraph/Attribute/Attribute/Attribute.swift index 3826d61..ea7fc43 100644 --- a/Sources/OpenGraph/Attribute/Attribute/Attribute.swift +++ b/Sources/OpenGraph/Attribute/Attribute/Attribute.swift @@ -72,7 +72,7 @@ public struct Attribute { public var projectedValue: Attribute { get { self } - _modify { yield &self } + set { self = newValue } } // MARK: - dynamicMemberLookup @@ -196,7 +196,7 @@ public struct Attribute { public var flags: OGAttributeFlags { get { identifier.flags } - _modify { yield &identifier.flags } + nonmutating set { identifier.flags = newValue } } public func setFlags(_ newFlags: OGAttributeFlags, mask: OGAttributeFlags) { diff --git a/Sources/_OpenGraph/Attribute/OGAttributeFlags.h b/Sources/_OpenGraph/Attribute/OGAttributeFlags.h index f871f07..390eb13 100644 --- a/Sources/_OpenGraph/Attribute/OGAttributeFlags.h +++ b/Sources/_OpenGraph/Attribute/OGAttributeFlags.h @@ -15,6 +15,8 @@ typedef OG_OPTIONS(uint32_t, OGAttributeFlags) { OGAttributeFlagsActive = 1 << 0, OGAttributeFlagsRemovable = 1 << 1, OGAttributeFlagsInvalidatable = 1 << 2, + + OGAttributeFlagsMask = 0xFF, }; #endif /* OGAttributeFlags_h */ diff --git a/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/AttributeTests.swift b/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/AttributeTests.swift index bcaa47e..d92448e 100644 --- a/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/AttributeTests.swift +++ b/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/AttributeTests.swift @@ -73,5 +73,12 @@ final class AttributeTests: AttributeTestBase { } } + + @Test + func flagSetter() { + let attribute = Attribute(value: ()) + attribute.flags = .active + #expect(attribute.flags == .active) + } } #endif