You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -55,25 +55,29 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
55
55
*[SE-0350][]:
56
56
57
57
The standard library has a new `Regex<Output>` type.
58
-
58
+
59
59
This type represents an _extended regular expression_, allowing more fluent
60
60
string processing operations. A `Regex` may be created by
61
61
[initialization from a string][SE-0355]:
62
-
```
62
+
63
+
```swift
63
64
let pattern ="a[bc]+"// matches "a" followed by one or more instances
64
65
// of either "b" or "c"
65
66
let regex =try!Regex(pattern)
66
67
```
68
+
67
69
Or via a [regex literal][SE-0354]:
68
-
```
70
+
71
+
```swift
69
72
let regex =#/a[bc]+/#
70
73
```
74
+
71
75
In Swift 6, `/` will also be supported as a delimiter for `Regex` literals.
72
76
You can enable this mode in Swift 5.7 with the `-enable-bare-slash-regex`
73
77
flag. Doing so will cause some existing expressions that use `/` as an
74
78
operator to no longer compile; you can add parentheses or line breaks as a
75
79
workaround.
76
-
80
+
77
81
There are [new string-processing algorithms][SE-0357] that support
78
82
`String`, `Regex` and arbitrary `Collection` types.
79
83
@@ -165,7 +169,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
165
169
Protocols with primary associated types can now be used in existential types,
166
170
enabling same-type constraints on those associated types.
167
171
168
-
```
172
+
```swift
169
173
let strings: anyCollection<String> = [ "Hello" ]
170
174
```
171
175
@@ -508,12 +512,12 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
508
512
structS {
509
513
@available(macOS99, *) // error: stored properties cannot be marked potentially unavailable with '@available'
510
514
lazyvar a: Int=42
511
-
515
+
512
516
@available(macOS99, *) // error: stored properties cannot be marked potentially unavailable with '@available'
513
517
@Wrappervar b: Int
514
518
}
515
519
```
516
-
520
+
517
521
* 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.
0 commit comments