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
[Refactoring] Fix crash when refactoring protocol requirement to async
When a function declaration has no body (e.g. because it’s a protocol requirement), we construct the range to replace by the `async` keyword as follows:
- Start: One character after the closing `)` (or potentially the `throws` keyword if it exists)
- End: Last token in the function declaration
Since the last token in the function declaration is the `)`, we end up with a range that has `End < Start`, which crashes when trying to print the range.
If the function has no body, we should just use the range’s start location as the end location to construct an empty range.
Fixes rdar://76677035
0 commit comments