-
Notifications
You must be signed in to change notification settings - Fork 215
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
Add regression test for relative imports in tests under lib
#2147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM without the ../lib
import version.
Fixes #2142 When a compiler is reading imports it's possible for a relative file import and absolute package import to the same library to get treated as separate libraries. The VM works around this in the case of a `main` under `lib/` by checking when the entrypoint, and only the entrypoint, could be referenced with a `package:` URI so that further relative URIs resolved from that point are consistently treated as `package:` URIs. Use the same workaround for bootstrap files. Add an `absoluteUri` utility in `test_core` which prefers `package:` URIs when feasible, and falls back to absolute file URIs otherwise. When this initial import uses a `package:` URI it will make the subsequent relative imports correctly resolve as `package:` URIs. Add `async` and `await` as necessary since we're currently using the async APIs to read the package config.
Oops, I meant to push a new branch and open a PR to pull into this branch, I hadn't intended to push on this branch. Sorry @jakemac53 ! |
This reverts commit 1d80449.
No worries, should I revert or want to land that together with the test? |
I reverted it on this branch. I think we should go ahead and land the test and then handle the fix in a separate PR. |
Validates the issue listed in #2142.
Skipped for now since it fails in all configurations.