sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Analyzer allows re-use of part files from core libraries

Open stereotype441 opened this issue 8 years ago • 2 comments

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.

stereotype441 avatar May 24 '17 16:05 stereotype441

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.

lrhn avatar Jul 06 '17 09:07 lrhn

The analyzer still allows such a URI.

srawlins avatar Apr 15 '23 05:04 srawlins