Skip to content

Commit

Permalink
use feature-specific guard for @retroactive (#2581)
Browse files Browse the repository at this point in the history
Motivation:

We should use the more granular guard for uses of @retroactive rather
than coarse swift versions to guard against corner-cases

Modifications:

Switch `#if compiler(>=5.11)` for `#if hasFeature(RetroactiveAttribute)`

Result:

No change in most cases, more protected against corner-cases.
  • Loading branch information
rnro committed Nov 1, 2023
1 parent 9497e44 commit 853522d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/NIOFoundationCompat/ByteBuffer-foundation.swift
Expand Up @@ -375,7 +375,8 @@ extension ByteBufferAllocator {
}

// MARK: - Conformances
#if compiler(>=5.11)
#if swift(>=5.8)
#if hasFeature(RetroactiveAttribute)
extension ByteBufferView: @retroactive ContiguousBytes {}
extension ByteBufferView: @retroactive DataProtocol {}
extension ByteBufferView: @retroactive MutableDataProtocol {}
Expand All @@ -384,6 +385,11 @@ extension ByteBufferView: ContiguousBytes {}
extension ByteBufferView: DataProtocol {}
extension ByteBufferView: MutableDataProtocol {}
#endif
#else
extension ByteBufferView: ContiguousBytes {}
extension ByteBufferView: DataProtocol {}
extension ByteBufferView: MutableDataProtocol {}
#endif

extension ByteBufferView {
public typealias Regions = CollectionOfOne<ByteBufferView>
Expand Down

0 comments on commit 853522d

Please sign in to comment.