Skip to content

Remove @testable imports, upgrading symbols to public visibility. #205

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 1 commit into from
Jun 16, 2020

Conversation

dylansturg
Copy link
Contributor

No description provided.

@@ -68,7 +68,7 @@ fileprivate class SyntaxValidatingVisitor: SyntaxVisitor {
/// syntax is valid.
///
/// - Parameter syntax: The root of a tree of syntax nodes to check for compatibility.
func firstInvalidSyntaxPosition(in syntax: Syntax) -> AbsolutePosition? {
public func firstInvalidSyntaxPosition(in syntax: Syntax) -> AbsolutePosition? {
Copy link
Member

Choose a reason for hiding this comment

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

Since we have to sacrifice access control now, please add a leading underscore to this function name so that it doesn't leak (as obviously) into the SwiftFormat public API. (IIRC, SourceKit may have some logic that excludes or deprioritizes declarations with leading underscores from code complete suggestions.)

Copy link
Contributor

Choose a reason for hiding this comment

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

SourceKit may have some logic that excludes or deprioritizes declarations with leading underscores from code complete suggestions

I think this is only for system frameworks but @rintaro will know for sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think Argyrios is right - code complete is still suggesting _firstInvalidSyntaxPosition as the first option when I type something similar with other alternatives. I tried inside-of this module and in other modules (specifically the relevant test case).

I think a leading underscore still provides a hint to avoid using this function.

Alternatively, I could use an enum to add a namespace around this function (e.g. SwiftFormatInternal). Let me know if you think we should try harder to hide it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, hiding _ prefixed symbols are for system frameworks only.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, bummer. Well, this is fine for now—the leading underscore should be enough of an indicator that it should be hands-off. We can consider cleaning it up later if we feel there's a larger need.

Thanks for clarifying, @akyrtzi and @rintaro !

@allevato allevato merged commit f4367f0 into swiftlang:master Jun 16, 2020
@dylansturg dylansturg deleted the fix_testable branch July 31, 2020 20:26
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.

4 participants