File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,28 @@ CHANGELOG
24
24
Swift 5.0
25
25
---------
26
26
27
+ * [ SR-4248] [ ] :
28
+
29
+ In Swift 5 mode, when casting an optional value to a generic placeholder type,
30
+ the compiler will be more conservative with the unwrapping of the value. The
31
+ result of such a cast now matches the result you would get in a non-generic
32
+ context.
33
+
34
+ For example:
35
+ ``` swift
36
+ func forceCast <U >(_ value : Any ? , to type : U.Type ) -> U {
37
+ return value as! U
38
+ }
39
+
40
+ let value: Any ? = 42
41
+ print (forceCast (value, to : Any .self ))
42
+ // prints: Optional(42)
43
+ // (prior to Swift 5, this would print: 42)
44
+
45
+ print (value as! Any )
46
+ // prints: Optional(42)
47
+ ```
48
+
27
49
* [ SE-0214] [ ] :
28
50
29
51
Renamed the ` DictionaryLiteral ` type to ` KeyValuePairs ` .
@@ -7176,3 +7198,4 @@ Swift 1.0
7176
7198
[SR- 2388 ]: < https: // bugs.swift.org/browse/SR-2388>
7177
7199
[SR- 2394 ]: < https: // bugs.swift.org/browse/SR-2394>
7178
7200
[SR- 2608 ]: < https: // bugs.swift.org/browse/SR-2608>
7201
+ [SR- 4248 ]: < https: // bugs.swift.org/browse/SR-4248>
You can’t perform that action at this time.
0 commit comments