Skip to content

Make sure that a package location is associated with the diagnostics emitted from PackageBuilder for a particular package #2945

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

Conversation

abertelrud
Copy link
Contributor

@abertelrud abertelrud commented Sep 19, 2020

Move the instantiation of PackageBuilder into the diagnostics.with(location:) closure that sets the package location.

Without this, errors thrown for a package would be associated with a location, but regularly emitted diagnostics would not. The reason is that when the PackageBuilder is instantiated outside of the diagnostics.with(location:), it keeps the unlocationed diagnostics engine as a property, and then uses that for all the diagnostics even though the construct() call happens inside of a with-location closure.

This change allows all the diagnostics emitted by the PackageBuilder to be properly associated with the package.

This also fixes a unit test that does not seem to have been testing the correct location to begin with.

…ocation:)` closure that sets the package location.

Without this, errors thrown for a package would be associated with a location, but regularly emitted diagnostics would not.  The reason is that when the PackageBuilder is instantiated outside of the `diagnostics.with(location:)`, it keeps the unlocationed diagnostics engine as a property, and then uses that for all the diagnostics even though the `construct()` call happens inside of a with-location closure.

This change allows all the diagnostics emitted by the PackageBuilder to be properly associated with the package.
@abertelrud
Copy link
Contributor Author

@swift-ci please smoke test

@abertelrud abertelrud merged commit cadaa5a into swiftlang:master Sep 19, 2020
@abertelrud abertelrud deleted the eng/packagegraphloader-diagnostics-should-be-tagged-with-package branch September 23, 2020 04: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.

1 participant