dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.21k stars 1.57k forks source link

CFE deviates from Dart language specification when parsing the 'import' statement #37334

Open zeroomega opened 5 years ago

zeroomega commented 5 years ago

Thank you for taking the time to file an issue!

This tracker is for issues related to:

If you aren't sure, file the issue here and we'll find the right home for it. In your issue, please include:

According to the language specification 2.2, statement:

import "dart:io" as io1 if (dart.library.io) "dart:core";

should be considered as invalid, as "dart:io" is already a <configurableUri>. And the rest of if (dart.library.io) "dart:core" cannot be matched by a <combinator>.

However, this statement is successfully parsed in dart2js which is used by dartpad. As shown in https://dartpad.dartlang.org/2d46cfbd0800029e8ff99265dc049946 . It looks like a parser bug of dart2js.

jakemac53 commented 5 years ago

Fwiw, analyzer and the vm also allow this so it is probably actually a fasta bug