Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Fix SourceFile Visitor #51

Merged
merged 2 commits into from
Apr 5, 2020
Merged

Fix SourceFile Visitor #51

merged 2 commits into from
Apr 5, 2020

Conversation

mattt
Copy link
Contributor

@mattt mattt commented Apr 5, 2020

As described in #16, #25, and #35, running swift-doc in a GitHub Action produces strange results, with overly-long API symbol names. While I'd originally attributed my inability to reproduce these results to a macOS v. Linux difference, it turns out to have been a matter of debug v. release.

I verified this locally by running tests in release mode (with the small change of making the import of SwiftDoc non-@testable):

$ swift test -c release
Test Suite 'All tests' failed at 2020-04-05 06:13:26.899.
	 Executed 1 test, with 12 failures (0 unexpected) in 0.072 (0.073) seconds

When building with a release configuration, the Swift compiler removes assertions. The problem with the current implementation is that we're doing something important in the assertion:

assert((pop() as? Symbol)?.api is Class)

Separating out the work from the test in 7f9680e fixed the underlying issue.

To prevent such behavioral differences from creeping up again in the future, I updated the CI action to test in release mode going forward with 7896787. Tests will run slower than before, but this will give us greater confidence in the results of the tests, since it matches the configuration of how swift-doc is built when running make install.

Assertions are disabled in release builds, which caused contexts to never be popped.
Remove @testable attribute in SwiftDoc import for release mode testing.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant