-
Notifications
You must be signed in to change notification settings - Fork 208
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
Augmentation libraries can't be main libraries as well? #3646
Comments
Yes, we should block cycles like this. |
It should be an error.
A library augmentation declaration is not a library declaration.) That means that if your program (entry point library) actually refers transitively to a library augmentation file, then it's through an So, today, it shouldn't be possible to include such a file in a program without getting a compile-time error. We can say the same thing for // foo.dart
part of 'foo.dart'; I don't think we say that this is an error today, but it's an error for a library to include a part file that doesn't point back to the library, which this one never would, so it cannot be part of a valid Dart program. |
Here's a proposal: #3676. |
The spec update in #3676 has been landed. |
Thanks to @sgrekhov for bringing up this question. The specification does not seem to mention the case where an augmentation library augments itself:
Presumably, that would be an error?
It seems reasonable to assume that the
import augment
graph should be a tree, so we'd naturally ask a similar question about this:It would presumably not be hard to create many kinds of cyclic
import augment
graphs, and I think they should all be errors.Perhaps we need a rule about a regular import:
That is, a regular import directive can import an augmented library (containing
import augment ...
, but notlibrary augment ...
), but it cannot import an augmentation library (containinglibrary augment
).The text was updated successfully, but these errors were encountered: