Files
swift-mirror/test/IRGen/Inputs/AlwaysInlineIntoWithOpaque.swift
Allan Shortlidge 775b4a47c0 AST: Inherit access level of opaque type decls from naming decl.
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
2023-06-12 12:05:25 -07:00

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
}