sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Incorrect position of type arguments error on map and list literals

Open peter-ahe-google opened this issue 7 years ago • 2 comments

$ cat t.dart
main() {
  print(<Object, Object, Object>[
    1,
    2,
    3,
  ]);
}
$ ./fasta compile t.dart
t.dart:2:33: Warning: Too many type arguments on List literal.
  print(<Object, Object, Object>[
                                ^

The location should be:

$ ./fasta compile t.dart
t.dart:2:33: Warning: Too many type arguments on List literal.
  print(<Object, Object, Object>[
        ^^^^^^^^^^^^^^^^^^^^^^^^

peter-ahe-google avatar Feb 20 '18 15:02 peter-ahe-google

Or perhaps:

$ ./fasta compile t.dart
t.dart:2:33: Warning: Too many type arguments on List literal.
  print(<Object, Object, Object>[
                 ^^^^^^^^^^^^^^

peter-ahe-google avatar Feb 20 '18 17:02 peter-ahe-google

In the analyzer this is highlighting the type parameter list (though I agree that highlighting the extra type arguments might make more sense). The CFE still highlights from[ to ].

bwilkerson avatar Jun 09 '25 22:06 bwilkerson