sdk
sdk copied to clipboard
Analyzer allows re-use of part files from core libraries
Consider the following program:
library dart.async;
part 'dart:async/future.dart';
main() {}
This program should be rejected, since dart:async/future.dart is not the URI of any file that can be validly used by client programs. However, as a side effect of the way analyzer resolves part declarations within the SDK, it considers dart:async/future.dart to be a valid pointer to the file lib/async/future.dart inside the Dart SDK, so it accepts this program without complaint.
Dart2js and the VM both correctly reject this file.
Just to elaborate: The URI dart:async/future.dart is bogus. It should not refer to anything, ever.
The dart scheme defines URIs that are not hierarchical. Resolving anything against a non-hierarchical URI is meaningless. The only dart URIs that have any meaning are the ones on the form dart:platform-library-name. Any other variant has no meaning, and should be rejected if anyone uses it as a URI.
If the analyzer uses such an URI-like-thing internally, it's obviously free to do so, but it must not leak in any way.
The analyzer still allows such a URI.