qRoC
(Andrey Savitsky)
1
Sample code:
public final class Box<T> where T: AnyObject {
internal typealias Address = UInt
@usableFromInline
internal var address: Address
@inlinable
public init(object: T) {
self.address = .init(bitPattern: Unmanaged<T>.passRetained(object).toOpaque())
}
}
OS: macOS
Swift: Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3)
Clang: Apple LLVM version 10.0.0 (clang-1000.10.25.5)
Result: compile success.
OS: Ubuntu 14.14
Swift: version 4.2 (swift-4.2-CONVERGENCE)
Clang: clang version 5.0.0 (tags/RELEASE_500/final)
Result:
error: type alias 'Address' is internal and should not be referenced from an '@inlinable' function
note: type alias 'Address' is not '@usableFromInline' or public
@usableFromInline does not work on typealias.
jrose
(Jordan Rose)
2
@usableFromInline does work on typealiases now. You'll have to update to a later Xcode 10 beta, though.