Skip to content

Diagnose modules with circular dependencies #16075

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

Conversation

jrose-apple
Copy link
Contributor

This can't arise from a clean build, but it can happen if you have products lingering in a search path and then either rebuild one of the modules in the cycle, or change the search paths.

The way this is implemented is for each module to track whether its imports have all been resolved. If, when loading a module, one of its dependencies hasn't resolved all of its imports yet, then we know there's a cycle.

This doesn't produce the best diagnostics, but it's hard to get into this state in the first place, so that's probably okay.

SR-7483 / rdar://problem/39598696

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c94076fe04ea66fbd1b581e55c426cdda1b91e66

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c94076fe04ea66fbd1b581e55c426cdda1b91e66

@jrose-apple jrose-apple force-pushed the to-the-tune-of-virtual-insanity branch from c94076f to 79d8ae9 Compare April 20, 2018 23:48
@jrose-apple
Copy link
Contributor Author

Source compat job continuing to run here

@akyrtzi Are you okay with deleting this old SourceKit test? A user-visible diagnostic seems sufficient to not worry about this case.

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c94076fe04ea66fbd1b581e55c426cdda1b91e66

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c94076fe04ea66fbd1b581e55c426cdda1b91e66

@jrose-apple
Copy link
Contributor Author

Whoops, deleted more than I should have. I'll pick this up in a week.

@jrose-apple jrose-apple force-pushed the to-the-tune-of-virtual-insanity branch from 79d8ae9 to 313d833 Compare May 2, 2018 02:19
@jrose-apple jrose-apple requested review from akyrtzi and benlangmuir May 2, 2018 02:19
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 2, 2018

Build failed
Swift Test Linux Platform
Git Sha - 79d8ae9703dfbd7cadc61799e47a2b12ae12d46f

@swift-ci
Copy link
Contributor

swift-ci commented May 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - 79d8ae9703dfbd7cadc61799e47a2b12ae12d46f

@benlangmuir
Copy link
Contributor

What happens in that index test that you deleted? Does it get your new error and produce no indexing info?

@jrose-apple
Copy link
Contributor Author

Yep, that's correct. And then I tried to tweak the other test to get the same result but apparently I did it incorrectly (I didn't test it locally first).

This can't arise from a clean build, but it can happen if you have
products lingering in a search path and then either rebuild one of
the modules in the cycle, or change the search paths.

The way this is implemented is for each module to track whether its
imports have all been resolved. If, when loading a module, one of its
dependencies hasn't resolved all of its imports yet, then we know
there's a cycle.

This doesn't produce the best diagnostics, but it's hard to get into
this state in the first place, so that's probably okay.

https://bugs.swift.org/browse/SR-7483
@jrose-apple jrose-apple force-pushed the to-the-tune-of-virtual-insanity branch from 313d833 to 0cc297b Compare May 2, 2018 18:38
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - 313d83392ed84ba83a69792787ebceb379c553f0

@swift-ci
Copy link
Contributor

swift-ci commented May 2, 2018

Build failed
Swift Test Linux Platform
Git Sha - 313d83392ed84ba83a69792787ebceb379c553f0

@jrose-apple jrose-apple merged commit df2e63d into swiftlang:master May 2, 2018
@jrose-apple jrose-apple deleted the to-the-tune-of-virtual-insanity branch May 2, 2018 22:01
jrose-apple added a commit to jrose-apple/swift that referenced this pull request May 2, 2018
This can't arise from a clean build, but it can happen if you have
products lingering in a search path and then either rebuild one of
the modules in the cycle, or change the search paths.

The way this is implemented is for each module to track whether its
imports have all been resolved. If, when loading a module, one of its
dependencies hasn't resolved all of its imports yet, then we know
there's a cycle.

This doesn't produce the best diagnostics, but it's hard to get into
this state in the first place, so that's probably okay.

https://bugs.swift.org/browse/SR-7483
(cherry picked from commit df2e63d)
jrose-apple added a commit that referenced this pull request May 3, 2018
This can't arise from a clean build, but it can happen if you have
products lingering in a search path and then either rebuild one of
the modules in the cycle, or change the search paths.

The way this is implemented is for each module to track whether its
imports have all been resolved. If, when loading a module, one of its
dependencies hasn't resolved all of its imports yet, then we know
there's a cycle.

This doesn't produce the best diagnostics, but it's hard to get into
this state in the first place, so that's probably okay.

https://bugs.swift.org/browse/SR-7483
(cherry picked from commit df2e63d)
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.

5 participants