Skip to content

Remove print-init subcommand from swift-parser-cli #908

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
Oct 10, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 10, 2022

debugInitCall, which is the backbone of swift-parser-cli is defined in _SwiftSyntaxTestSupport, which links against XCTest. If swift-parser-cli links against _SwiftSyntaxTestSupport, it also links against XCTest, causing its execution to fail with a dyld error outside of Xcode.

The solution would be to move debugInitCall into a new module that swift-parser-cli can link against but IMHO the print-init subcommand doesn’t provide sufficent value for that since you most likely want to use it in test cases where you can use a debugger command to get the debugInitCall result: e print(tree.debugInitCall).

@ahoppen ahoppen requested a review from bnbarham October 10, 2022 09:02
@ahoppen ahoppen force-pushed the ahoppen/no-dependency-cli-xctest branch from ea895b8 to c755fcb Compare October 10, 2022 10:23
@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2022

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2022

@swift-ci Please test macOS

`debugInitCall`, which is the backbone of `swift-parser-cli` is defined in `_SwiftSyntaxTestSupport`, which links against XCTest. If `swift-parser-cli` links against `_SwiftSyntaxTestSupport`, it also links against `XCTest`, causing its execution to fail with a dyld error outside of Xcode.

The solution would be to move `debugInitCall` into a new module that `swift-parser-cli` can link against but IMHO the `print-init` subcommand doesn’t provide sufficent value for that since you most likely want to use it in test cases where you can use a debugger command to get the `debugInitCall` result: `e print(tree.debugInitCall)`.
@ahoppen ahoppen force-pushed the ahoppen/no-dependency-cli-xctest branch from c755fcb to f33b3fc Compare October 10, 2022 12:59
@ahoppen
Copy link
Member Author

ahoppen commented Oct 10, 2022

@swift-ci Please test

@ahoppen ahoppen merged commit 68e5315 into swiftlang:main Oct 10, 2022
@ahoppen ahoppen deleted the ahoppen/no-dependency-cli-xctest branch October 10, 2022 15:55
@bnbarham
Copy link
Contributor

Unfortunate. I'd still be fine with it being a part of SwiftSyntax (behind SPI if you really care) - it seems like a generally useful function to me 🤷.

@ahoppen
Copy link
Member Author

ahoppen commented Oct 11, 2022

It can’t be part of SwiftSyntax because it uses SwiftSyntaxBuilder. We could add it to the SwiftSyntaxBuilder module but that also really doesn’t seem like the right place to put it.

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.

2 participants