Skip to content

Commit 2c425f0

Browse files
authored
Merge pull request swiftlang#59727 from slavapestov/changelog-redundant-requirements
Add CHANGELOG entry for redundant requirement warnings being disabled by default
2 parents 04bbde1 + c459921 commit 2c425f0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
55

66
## Swift 5.7
77

8+
* The Swift compiler no longer warns about redundant requirements in generic declarations. For example,
9+
the following code diagnosed a warning in Swift 5.6 about the `T.Iterator : IteratorProtocol`
10+
requirement being redundant, because it is implied by `T : Sequence`:
11+
12+
```swift
13+
func firstElement<T: Sequence>(_: T) -> T.Element where T.Iterator: IteratorProtocol {...}
14+
```
15+
16+
A redundant requirement does not indicate a coding error, and sometimes it is desirable to spell them
17+
out for documentation purposes. For this reason these warnings are now disabled by default.
18+
19+
To restore the previous behavior, pass the `-Xfrontend -warn-redundant-requirements`
20+
compiler flag.
21+
822
* [SE-0338][]:
923

1024
Non-isolated async functions now always execute on the global concurrent pool,

0 commit comments

Comments
 (0)