Skip to content

Adopt lexicalContext from swift-syntax-6.0.0. #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Mar 11, 2024

This PR conditionally adopts the new lexicalContext member of MacroExpansionContext added in swiftlang/swift-syntax#1554. If the SwiftSyntax600 pseudo-module is available, then this member should be available for use and can be used to perform additional diagnostics for tests and to get the names of their containing types.

With this PR, if built against an older toolchain (5.11 or earlier), the old hacky "is there leading whitespace?" mechanism is still used.

A future PR will recursively perform suite-level diagnostics on the lexical contexts containing tests and suites, so that a test cannot be (easily) inserted into a type that cannot be used as a suite.

Resolves rdar://109439578.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan changed the title Adopt lexicalContext from swift-syntax-6.0.0. [DO NOT MERGE YET] Adopt lexicalContext from swift-syntax-6.0.0. Mar 11, 2024
@grynspan grynspan force-pushed the jgrynspan/109439578-lexical-context branch from 367a9a1 to 3f27a94 Compare March 12, 2024 01:05
@grynspan
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan changed the title [DO NOT MERGE YET] Adopt lexicalContext from swift-syntax-6.0.0. Adopt lexicalContext from swift-syntax-6.0.0. Mar 12, 2024
@grynspan grynspan requested a review from DougGregor March 12, 2024 18:42
Copy link
Contributor

@dennisweissmann dennisweissmann left a comment

Choose a reason for hiding this comment

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

Nice!

@grynspan grynspan force-pushed the jgrynspan/109439578-lexical-context branch from 0fa73ce to 7d10292 Compare March 13, 2024 15:30
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan
Copy link
Contributor Author

@swift-ci please test Linux

@grynspan grynspan mentioned this pull request Mar 13, 2024
2 tasks
@grynspan
Copy link
Contributor Author

Holding on to this PR for the moment as I'd like @DougGregor's review as well.

@grynspan grynspan force-pushed the jgrynspan/109439578-lexical-context branch from 7d10292 to 7930fbf Compare March 22, 2024 16:06
grynspan added 2 commits April 1, 2024 16:12
This PR conditionally adopts the new `lexicalContext` member of
`MacroExpansionContext` added in swiftlang/swift-syntax#1554.
If the SwiftSyntax600 pseudo-module is available, then this member should be
available for use and can be used to perform additional diagnostics for tests
and to get the names of their containing types.

With this PR, if built against an older toolchain (5.11 or earlier), the old
hacky "is there leading whitespace?" mechanism is still used.

A future PR will recursively perform suite-level diagnostics on the lexical
contexts containing tests and suites, so that a test cannot be (easily) inserted
into a type that cannot be used as a suite.

Resolves rdar://109439578.
@grynspan grynspan force-pushed the jgrynspan/109439578-lexical-context branch from 7930fbf to 85ecedf Compare April 1, 2024 20:40
@grynspan
Copy link
Contributor Author

grynspan commented Apr 1, 2024

@swift-ci please test

@grynspan grynspan merged commit 9446983 into main Apr 1, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/109439578-lexical-context branch April 1, 2024 21:11
grynspan added a commit that referenced this pull request Apr 4, 2024
grynspan added a commit that referenced this pull request Apr 4, 2024
Follow-up to #279 and #302.

### Checklist:

- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants