dart-sdk/tests/language/map/literal13_test.dart
Jens Johansen ac9b4aab8d [parser] More specific error messages when recovering new/const/Map/Set/List with said literals
Follow-up to https://dart-review.googlesource.com/c/sdk/+/190022

Change-Id: Id42336216267dcbf481ae6e111177e6296ea6779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-25 13:27:03 +00:00

25 lines
992 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Legacy compound literal syntax that should go away.
main() {
var map = new Map<int>{ "a": 1, "b": 2, "c": 3 };
// ^^^^^^^
// [analyzer] SYNTACTIC_ERROR.LITERAL_WITH_CLASS_AND_NEW
// [cfe] A map literal can't be prefixed by 'new Map'.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MAP_ENTRY_NOT_IN_MAP
// ^
// [cfe] Expected ',' before this.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MAP_ENTRY_NOT_IN_MAP
// ^
// [cfe] Expected ',' before this.
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.MAP_ENTRY_NOT_IN_MAP
// ^
// [cfe] Expected ',' before this.
}