Improve unexpected tokens diagnostics
While investigating https://github.com/swiftlang/swift-syntax/issues/1373 I noticed that replacing a break with a continue in canRecoverTo improves diagnostic in a number of recovery tests.
I've also added a little logic to call skipSingle so we achieve desired diagnostic in testRecovery105(), but only if possible at the same line, so cases like testRecovery100() is not messed up.
@swift-ci Please test
Couldn't figure out what caused the tests to fail 🤔
Looks like BasicFormatTest.testClosureParameter failed. That test did look unrelated to your other changes anyway.
/Users/ec2-user/jenkins/workspace/swift-syntax-PR-macOS/branch-main/swift-syntax/Tests/SwiftBasicFormatTest/BasicFormatTests.swift:62: error: -[SwiftBasicFormatTest.BasicFormatTest testClosureParameter] : failed - Actual output does not match the expected
myFunc({
return true
–})
+ })
@swift-ci Please test
@swift-ci Please test Windows
Oh, looks like the errors are unrelated to your PR, they also seem to fail in https://github.com/swiftlang/swift-syntax/pull/2814.
These failed in https://github.com/swiftlang/swift-syntax/pull/2814 too.
I think https://github.com/swiftlang/swift/pull/76040 will fix this issue
@ahoppen I think this should pass now that https://github.com/swiftlang/swift/pull/76040 has been merged. Could you test again, please?
@swift-ci please test
Thanks @DougGregor !