Files
swift-mirror/test/stdlib/Identifiable.swift
Allan Shortlidge 1c9b6eb723 Sema: Relax availability of typealiases for inferred type witness.
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
2024-08-23 15:49:51 -07:00

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
}
}