mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When an `OpaqueTypeDecl` is constructed, the access level attributes of the decl that names the opaque type were copied on to it. However, the `@usableFromInline` attribute is not permitted on every decl, so it does not get copied. This in turn causes access level computations for opaque types to fail to take `@usableFromInline` into account and that results in the emitted symbol getting the wrong linkage during IRGen. The fix is to make access level computations take this quirk of opaque types into account directly (like they already to for several other kinds of decls), instead of relying on copying of attributes. Resolves rdar://110544170
30 lines
442 B
Swift
30 lines
442 B
Swift
public protocol P {
|
|
}
|
|
|
|
extension Int : P {
|
|
}
|
|
|
|
extension Double : P {
|
|
}
|
|
|
|
@_alwaysEmitIntoClient
|
|
public func testInlineWithOpaque() -> some P {
|
|
if #available(macOS 9.0, *) {
|
|
return 1
|
|
}
|
|
return 2.0
|
|
}
|
|
|
|
@_alwaysEmitIntoClient
|
|
public func testInlineWithOpaqueUsableFromInline() -> some P {
|
|
if #available(macOS 9.0, *) {
|
|
return usableFromInline()
|
|
}
|
|
return 4.0
|
|
}
|
|
|
|
@usableFromInline
|
|
func usableFromInline() -> some P {
|
|
return 3
|
|
}
|