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
swift-parser-test was easily confusable with the SwiftParserTest test target for newcomers.
Also, rename the `print-tree` subcommand to `tree` and `dump-diags` to `diags`. That’s a little shorter to type and you don’t need to remember which of the two commands was `dump` and which one was `print`.
Copy file name to clipboardExpand all lines: Sources/SwiftParser/SwiftParser.docc/FilingBugReports.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
Guide to provide steps for filing actionable bug reports for parser failures.
4
4
5
-
Reducing a test case requires the `swift-parser-test` utility that you can build by checking out `swift-syntax` and running `swift build --product swift-parser-test` or building the `swift-parser-test` target in Xcode.
5
+
Reducing a test case requires the `swift-parser-cli` utility that you can build by checking out `swift-syntax` and running `swift build --product swift-parser-cli` or building the `swift-parser-cli` target in Xcode.
6
6
7
7
## Round-Trip Failure or Parser Crash
8
8
9
9
If you encounter a case where printing the parsed syntax tree does not reproduce the original source file, that’s a round-tripping failure and is considered a serious bug in SwiftSyntax – preserving the original source is a core principle of this library. To reproduce and reduce the failure, perform the following steps
2. File a bug report on <https://github.com/apple/swift-syntax/issues/new/choose> with the reduced source code or fix the issue yourself by following the steps in <doc:FixingBugs>.
16
16
@@ -20,7 +20,7 @@ If you have source code that is parsed correctly by the current Swift compiler (
20
20
21
21
1. Run the following command to see the diagnostics produced by the parser
22
22
```
23
-
swift-parser-test print-diags /path/to/file.swift
23
+
swift-parser-cli print-diags /path/to/file.swift
24
24
```
25
25
2. Remove as much code as possible from your test file and check if it still produces the same diagnostic.
26
26
3. File a bug report on <https://github.com/apple/swift-syntax/issues/new/choose> with the reduced source code or fix the issue yourself by following the steps in <doc:FixingBugs>.
@@ -31,7 +31,7 @@ If you have valid source code that produced a syntax tree which doesn’t repres
31
31
32
32
1. Run the following command to print the parsed syntax tree
33
33
```
34
-
swift-parser-test dump-tree /path/to/file.swift
34
+
swift-parser-cli print-tree /path/to/file.swift
35
35
```
36
36
2. Remove as much code as possible from your test file and check if it still produces the same invalid tree
37
37
3. File a bug report on <https://github.com/apple/swift-syntax/issues/new/choose> with the reduced source code or fix the issue yourself by following the steps in <doc:FixingBugs>.
Copy file name to clipboardExpand all lines: Sources/SwiftParser/SwiftParser.docc/FixingBugs.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Unhelpful diagnostics can result from two reasons:
44
44
45
45
To distinguish these cases run the following command and look at the dumped syntax tree. Use your own judgment to decide whether this models the intended meaning of the source code reasonably well.
Fixing the first case where the parser does not recover according to the user’s intent is similar to [Parse of Valid Source Code Produced an Invalid Syntax Tree](#Parse-of-Valid-Source-Code-Produced-an-Invalid-Syntax-Tree). See <doc:SwiftParser/ParserRecovery> for documentation how parser recovery works and determine how to recover better from the invalid source code.
0 commit comments