-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use package: URIs for imports when possible
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.
- Loading branch information
Showing
6 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
@Skip('https://github.com/dart-lang/test/issues/2142') | ||
library; | ||
|
||
import 'package:test/test.dart'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters