Skip to content

Conversation

vinu-vanjari
Copy link
Contributor

@vinu-vanjari vinu-vanjari commented Feb 10, 2024

Resolves #2431


Changes Summary:

1. Added shouldBeInsertedBeforePreviousTokenTrivia

Extracted this from existing code from DiagnosticExtensions.swift
Inserted this just after existing property shouldBeInsertedAfterNextTokenTrivia
This extraction is needed as we want to reuse this while deciding correct insertion location of fix-it

2. Correct insertion location for fix-it in MissingNodesError.swift

This should correct ), :, , syntax positions which should be inserted before previous token trivia. i.e. should not have whitespace before them. (check unit tests corrections for examples)

3. Correction of Unit Tests

Corrected the existing unit tests where missing ')' token error was expected.
Notice that we only change location markers and not other things in the unit tests.
None of the fixedSource in the examples in unit tests are changed

4. Added couple of Unit Tests
  • ParserDiagnosticsFormatterIntegrationTests.swift->testRighParenLocation()
  • TypeExprTests.swift->testTypeExpr31()

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice and simple fix 😍

@ahoppen
Copy link
Member

ahoppen commented Feb 12, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge February 12, 2024 22:35
@ahoppen ahoppen merged commit 45ee19f into swiftlang:main Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong insertion location in fix-it for missing parentheses around parameter type list

2 participants