swift-syntax icon indicating copy to clipboard operation
swift-syntax copied to clipboard

Improve unexpected tokens diagnostics

Open mateusrodriguesxyz opened this issue 1 year ago • 3 comments

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.

mateusrodriguesxyz avatar Aug 19 '24 20:08 mateusrodriguesxyz

@swift-ci Please test

ahoppen avatar Aug 20 '24 14:08 ahoppen

Couldn't figure out what caused the tests to fail 🤔

mateusrodriguesxyz avatar Aug 20 '24 17:08 mateusrodriguesxyz

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
–})
+    })

ahoppen avatar Aug 20 '24 21:08 ahoppen

@swift-ci Please test

ahoppen avatar Aug 21 '24 16:08 ahoppen

@swift-ci Please test Windows

ahoppen avatar Aug 21 '24 17:08 ahoppen

Oh, looks like the errors are unrelated to your PR, they also seem to fail in https://github.com/swiftlang/swift-syntax/pull/2814.

ahoppen avatar Aug 22 '24 13:08 ahoppen

These failed in https://github.com/swiftlang/swift-syntax/pull/2814 too.

mateusrodriguesxyz avatar Aug 22 '24 13:08 mateusrodriguesxyz

I think https://github.com/swiftlang/swift/pull/76040 will fix this issue

DougGregor avatar Aug 22 '24 16:08 DougGregor

@ahoppen I think this should pass now that https://github.com/swiftlang/swift/pull/76040 has been merged. Could you test again, please?

mateusrodriguesxyz avatar Aug 26 '24 17:08 mateusrodriguesxyz

@swift-ci please test

DougGregor avatar Aug 26 '24 18:08 DougGregor

Thanks @DougGregor !

mateusrodriguesxyz avatar Aug 27 '24 00:08 mateusrodriguesxyz