Commits
Devin Coughlin committed 217d17d6e6f
Sema: Consider availability of protocol declaration when diagnosing protocol witness availability.
Now that we allow types to conform to protocols that are less available than the
type itself, we should consider the availability of the protocol when
determining whether a witness is sufficiently available to satisfy the protocol
requirement.
In particular, we should allow the following:
@available(iOS 9.0, *)
class UIRefrigerator { }
@available(iOS 9.0, *)
protocol UIRefrigeratorDelegate {
func refrigeratorDidCool(refrigerator: UIRefrigerator)
}
@available(iOS 7.0, *)
class MyViewController : UIViewController, UIRefrigeratorDelegate {
@available(iOS 9.0, *)
func refrigeratorDidCool(refrigerator: UIRefrigerator) {
...
}
}
This is safe because MyViewController's refrigeratorDidCool() witness is
available everywhere the protocol is available. To check this, we now
additionally intersect the availability of the protocol with the availabilities
of the witness and the requirement before checking containment.
Swift SVN r29996