opened
askeksa-google
username_0
We want to make it an error to use a file as a part in more than one library in the same program.

In the co19 code, `Utils/expect_common.dart` is used as a part in all of the `Expect` libraries: `Utils/expect.dart`, `UtilsHtml/expect.dart` and `WebPlatformTest/Utils/expectWeb.dart`.

This is not in itself a problem, since these `Expect` libraries are not meant to be used in the same program. However, `Utils/async_utils.dart` includes `Utils/expect.dart` to use the `Expect.isFalse` function, which means that when `Utils/async_utils.dart` is imported in a test which imports one of the other `Expect` libraries, the part gets used twice in the same program.

One way to get around this would be to change `Utils/async_utils.dart` to be a part which is included into all of the `Expect` libraries (alongside `Utils/expect_common.dart`) and remove the imports of `Utils/async_utils.dart`from all tests (there are a lot of these). If this is done, the copy of (most of) the `Utils/async_utils.dart` code in `WebPlatformTest/Utils/expectWeb.dart` could be removed and replaced by a `part` directive.

A possibly simpler way could be to get rid of the dependency on `Utils/expect.dart` in `Utils/async_utils.dart` so it can be imported from tests using any version of the `Expect` library.
Avoid using the same file as a part in more than one library in the same program
issue
created
askeksa-google
username_0
Anyone looking into this? We would like to do this change in the Dart front-end before the Dart2Stable milestone: https://github.com/dart-lang/sdk/milestone/12

I can provide a PR for the simple fix (which doesn't affect any test cases and thus shouldn't interfere with generated code) if desired?
comment
created
sgrekhov
username_1
@username_0 I'll fix it, thank you
comment
created
sgrekhov
username_1
Fix in master branch (for Dart 1.x) 9858ee7d79cf09b50d6b5bc13fb950ae5f357954
comment
closed
sgrekhov
username_1
issue