Skip to content

Commit d575bba

Browse files
committed
Add an entry to the change log for rdar://83731428 and rdar://87795154.
1 parent 1f32e83 commit d575bba

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
@@ -5,6 +5,29 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
55

66
## Swift 5.7
77

8+
* The compiler now correctly emits warnings for more kinds of expressions where a protocol conformance is used and may be unavailable at runtime. Previously, member reference expressions and type erasing expressions that used potentially unavailable conformances were not diagnosed, leading to potential crashes at runtime.
9+
10+
```swift
11+
struct Pancake {}
12+
protocol Food {}
13+
14+
extension Food {
15+
var isGlutenFree: Bool { false }
16+
}
17+
18+
@available(macOS 12.0, *)
19+
extension Pancake: Food {}
20+
21+
@available(macOS 11.0, *)
22+
func eatPancake(_ pancake: Pancake) {
23+
if (pancake.isGlutenFree) { // warning: conformance of 'Pancake' to 'Food' is only available in macOS 12.0 or newer
24+
eatFood(pancake) // warning: conformance of 'Pancake' to 'Food' is only available in macOS 12.0 or newer
25+
}
26+
}
27+
28+
func eatFood(_ food: Food) {}
29+
```
30+
831
* [SE-0328][]:
932

1033
Opaque types (expressed with 'some') can now be used in structural positions

0 commit comments

Comments
 (0)