Skip to content

Commit e592a7a

Browse files
authored
Merge pull request swiftlang#177 from ahoppen/bidirectional-collection-readme
[Changelog] SyntaxCollection now conforms to BidirectionalCollection
2 parents 3d9b9d5 + 920193c commit e592a7a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Changelog.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@ Note: This is in reverse chronological order, so newer entries are added to the
44

55
## Swift 5.2
66

7+
- `ReversedSyntaxChildren` has been removed
8+
9+
Use the `reversed()` property on `SyntaxCollection`, which now conforms to `BidirectionalCollection` instead.
10+
11+
- `SyntaxCollection`s now conform to `BidirectionalCollection`
12+
13+
The previous conformance to `Sequence` has been upgraded to a conformance to `BidirectionalCollection`
14+
715
- Properties `isExpr`, `isDecl`, `isStmt`, `isType` and `isPattern` removed from `SyntaxNode`
816

917
Use `is(ExprSyntaxProtocol.self)` etc. instead.
1018

11-
- Property `uniqueIdentifier` removed from syntax nodes and `SyntaxNode` ([#164](https://github.com/apple/swift-syntax/pull/164))
19+
- Property `uniqueIdentifier` removed from syntax nodes and `SyntaxNode`
1220

1321
Use the newly added property `id` or the conformance to `Identifiable` instead.
1422

15-
- Syntax nodes and `SyntaxNode` conform to `Identifiable` ([#164](https://github.com/apple/swift-syntax/pull/164))
23+
- Syntax nodes and `SyntaxNode` conform to `Identifiable`
1624

1725
`Identifiable` conformance has been added to all syntax nodes and the `SyntaxNode` type using `SyntaxIdentifier` as the identifier.
1826

19-
- The `walk` method on syntax nodes has been removed. ([#158](https://github.com/apple/swift-syntax/pull/158))
27+
- The `walk` method on syntax nodes has been removed.
2028

2129
Instead, use the `walk` method on the `SyntaxVisitor`.
2230

@@ -28,7 +36,7 @@ Note: This is in reverse chronological order, so newer entries are added to the
2836
visitor.walk(tree)
2937
```
3038

31-
- `SyntaxVisitor` and `SyntaxAnyVisitor` are a `class` and no longer a `protocol`. ([#158](https://github.com/apple/swift-syntax/pull/158))
39+
- `SyntaxVisitor` and `SyntaxAnyVisitor` are a `class` and no longer a `protocol`.
3240

3341
For performance reasons the `SyntaxVisitor` and `SyntaxAnyVisitor` were migrated from being a protocol to being a class.
3442

@@ -50,7 +58,7 @@ Note: This is in reverse chronological order, so newer entries are added to the
5058
}
5159
```
5260

53-
- A new type `SyntaxEnum` has been introduced ([#155](https://github.com/apple/swift-syntax/pull/155))
61+
- A new type `SyntaxEnum` has been introduced
5462

5563
The new type `SyntaxEnum` allow exhaustive switching over all syntax types. It can be constructed by calling `asSyntaxEnum` on `Syntax`.
5664

@@ -68,7 +76,7 @@ Note: This is in reverse chronological order, so newer entries are added to the
6876

6977
For increased performance, the modelling of the syntax node hierarchy has been switched from being `protocol`-based to being `struct`-based. This includes the following changes:
7078

71-
- The protocols `ExprSyntax`, `DeclSyntax`, `Syntax` etc. have been removed. ([#155](https://github.com/apple/swift-syntax/pull/155))
79+
- The protocols `ExprSyntax`, `DeclSyntax`, `Syntax` etc. have been removed
7280

7381
For passing values of these types around, use the new type erasers `ExprSyntax`, `DeclSyntax`, `Syntax` etc. instead. To add computed properties or functions to all expression nodes, write an extension on `ExprSyntaxProtocol`. To add methods to all syntax nodes, extend `SyntaxProtcol`.
7482

@@ -95,7 +103,7 @@ For increased performance, the modelling of the syntax node hierarchy has been s
95103
```
96104

97105

98-
- Checking a node's type can no longer be performed using the `is` operator. Use the `is(_: SyntaxProtocol)` method on any type eraser instead. ([#155](https://github.com/apple/swift-syntax/pull/155))
106+
- Checking a node's type can no longer be performed using the `is` operator. Use the `is(_: SyntaxProtocol)` method on any type eraser instead.
99107

100108
```swift
101109
// Before
@@ -115,7 +123,7 @@ For increased performance, the modelling of the syntax node hierarchy has been s
115123
```
116124

117125

118-
- Downcasting can no longer be performed using the `as` operator. For downcasting use the `as(_: SyntaxProtocol)` method on any type eraser. ([#155](https://github.com/apple/swift-syntax/pull/155))
126+
- Downcasting can no longer be performed using the `as` operator. For downcasting use the `as(_: SyntaxProtocol)` method on any type eraser.
119127

120128
```swift
121129
// Before
@@ -125,7 +133,7 @@ For increased performance, the modelling of the syntax node hierarchy has been s
125133
exprSyntax.as(IdentifierExprSyntax.self)
126134
```
127135

128-
- Upcasting needs to be performed explicitly. Use the designated initializers for this. ([#155](https://github.com/apple/swift-syntax/pull/155))
136+
- Upcasting needs to be performed explicitly. Use the designated initializers for this.
129137

130138
```swift
131139
// Before

0 commit comments

Comments
 (0)