Skip to content

Commit 3dd77ef

Browse files
authored
Merge pull request swiftlang#30378 from AnthonyLatsis/patch-1
Add CHANGELOG entry for SE-0267
2 parents f6662a8 + 5485e10 commit 3dd77ef

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ CHANGELOG
2626
Swift Next
2727
----------
2828

29+
* [SE-0267][]:
30+
31+
Non-generic members that support a generic parameter list, including nested type declarations, are now allowed to carry a contextual `where` clause against outer generic parameters. Previously, such declarations could only be expressed by placing the member inside a dedicated constrained extension.
32+
33+
```swift
34+
struct Box<Wrapped> {
35+
func boxes() -> [Box<Wrapped.Element>] where Wrapped: Sequence { ... }
36+
}
37+
```
38+
Since contextual `where` clauses are effectively visibility constraints, overrides adopting this feature must be at least as visible as the overridden method. In practice, this implies any instance of `Derived` that can access `Base.foo` must also be able to access `Derived.foo`.
39+
40+
```swift
41+
class Base<T> {
42+
func foo() where T == Int { ... }
43+
}
44+
45+
class Derived<U>: Base<U> {
46+
// OK, <U where U: Equatable> has broader visibility than <T where T == Int>
47+
override func foo() where U: Equatable { ... }
48+
}
49+
```
50+
2951
* [SE-0266][]:
3052

3153
Enumerations with no associated values, or only `Comparable` associated values, can opt-in to synthesized `Comparable` conformance by declaring conformance to the `Comparable` protocol. The synthesized implementation orders the cases first by case-declaration order, and then by lexicographic order of the associated values (if any).
@@ -7914,6 +7936,7 @@ Swift 1.0
79147936
[SE-0253]: <https://github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
79157937
[SE-0254]: <https://github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
79167938
[SE-0266]: <https://github.com/apple/swift-evolution/blob/master/proposals/0266-synthesized-comparable-for-enumerations.md>
7939+
[SE-0267]: <https://github.com/apple/swift-evolution/blob/master/proposals/0267-where-on-contextually-generic.md>
79177940
[SE-0269]: <https://github.com/apple/swift-evolution/blob/master/proposals/0269-implicit-self-explicit-capture.md>
79187941

79197942
[SR-106]: <https://bugs.swift.org/browse/SR-106>

0 commit comments

Comments
 (0)