-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Require @usableFromInline on associated type witnesses #20384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Inlinable code is permitted to rely on these associated types, so we need to make sure their declarations are printed in the parseable interface. Part of rdar://problem/43824052
...when the protocol and the conforming type are not both public but are both public-or-usableFromInline. It's possible to write inlinable functions that depend on these types: public protocol HasAssoc { associatedtype Assoc } public func getAssoc<T: HasAssoc>(_: T) -> T.Assoc @usableFromInline struct Impl: HasAssoc { @usableFromInline typealias Assoc = Int } @inlinable func test() { let x: Int = getAssoc(Impl()) } rdar://problem/43824052
@swift-ci Please test |
@swift-ci Please test source compatibility |
@swift-ci Please benchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Build comment file:Performance: -Onone
Code size: Swift libraries
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR. Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein). Hardware Overview
|
@swift-ci Please test source compatibility |
...when the protocol and the conforming type are not both public but are both public-or-usableFromInline. It's possible to write inlinable functions that depend on these types:
rdar://problem/43824052