mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Only constrain the availability of the synthesized typealias for an inferred
type witness by the availability of the associated type if the associated type
is less available than its protocol. Without this, source compatibility is
broken for some conformances. For example:
```
struct IdentifiableValue: Identifiable {
let id = 42
}
extension IdentifiableValue {
// error: 'ID' is only available in macOS 10.15 or newer
var nextID: ID {
return id + 1
}
}
```
Fixes a regression introduced by https://github.com/swiftlang/swift/pull/71496.
Resolves rdar://134584323
14 lines
213 B
Swift
14 lines
213 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
struct IdentifiableValue: Identifiable {
|
|
let id = 42
|
|
}
|
|
|
|
class IdentifiableClass: Identifiable {}
|
|
|
|
extension IdentifiableValue {
|
|
var nextID: ID {
|
|
return id + 1
|
|
}
|
|
}
|