From 41bc0b4d0730202555150bc574a9df0b46df2d44 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Mon, 27 Feb 2023 22:48:51 +0000 Subject: [PATCH] opt assignable_expression_test into 2.19 opt switch related tests back to 2.19 opt map/set hashCode override tests back to 2.19 Change-Id: Ib5c44fc17de43eaf9bcad71d7a326c5fcbff02bf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285800 Auto-Submit: Jake Macdonald Reviewed-by: Bob Nystrom Commit-Queue: Jake Macdonald --- .../const/map_hashcode_override2_test.dart | 2 ++ .../language/const/map_hashcode_override_test.dart | 2 ++ .../const/set_hashcode_override2_test.dart | 2 ++ tests/language/const/switch2_test.dart | 2 ++ ...nst_functions_switch_statements_error_test.dart | 14 -------------- .../generic_usage_function_error_test.dart | 2 ++ .../usage_function_error_test.dart | 2 ++ tests/language/switch/bad_case_test.dart | 5 ++++- .../case_expression_with_assignment_test.dart | 2 ++ tests/language/switch/case_test.dart | 2 ++ tests/language/switch/case_warn_test.dart | 2 ++ tests/language/switch/empty_block_case_test.dart | 2 ++ tests/language/switch/fallthru_test.dart | 2 ++ .../unsorted/assignable_expression_test.dart | 2 ++ 14 files changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/language/const/map_hashcode_override2_test.dart b/tests/language/const/map_hashcode_override2_test.dart index d2e58588b65..d526da1a06f 100644 --- a/tests/language/const/map_hashcode_override2_test.dart +++ b/tests/language/const/map_hashcode_override2_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2021, 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. +// +// @dart=2.19 import 'package:expect/expect.dart'; diff --git a/tests/language/const/map_hashcode_override_test.dart b/tests/language/const/map_hashcode_override_test.dart index b9dd2573632..061f5707699 100644 --- a/tests/language/const/map_hashcode_override_test.dart +++ b/tests/language/const/map_hashcode_override_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2021, 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. +// +// @dart=2.19 import 'package:expect/expect.dart'; diff --git a/tests/language/const/set_hashcode_override2_test.dart b/tests/language/const/set_hashcode_override2_test.dart index cbe8944b1f0..92b5c7b7ee4 100644 --- a/tests/language/const/set_hashcode_override2_test.dart +++ b/tests/language/const/set_hashcode_override2_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2021, 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. +// +// @dart=2.19 import 'package:expect/expect.dart'; diff --git a/tests/language/const/switch2_test.dart b/tests/language/const/switch2_test.dart index 7d784f11f5a..94e33200254 100644 --- a/tests/language/const/switch2_test.dart +++ b/tests/language/const/switch2_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2014, 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. +// +// @dart=2.19 import 'package:expect/expect.dart'; diff --git a/tests/language/const_functions/const_functions_switch_statements_error_test.dart b/tests/language/const_functions/const_functions_switch_statements_error_test.dart index 659e3a43d3e..172d0537a40 100644 --- a/tests/language/const_functions/const_functions_switch_statements_error_test.dart +++ b/tests/language/const_functions/const_functions_switch_statements_error_test.dart @@ -27,17 +27,3 @@ int labelDoesNotExistSwitch(int x) { } return 0; } - -const var2 = wrongTypeSwitch(1); -// ^^^^^^^^^^^^^^^^^^ -// [analyzer] COMPILE_TIME_ERROR.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE -int wrongTypeSwitch(int x) { - switch (x) { - case "string": - // ^^^^^^^^ - // [analyzer] COMPILE_TIME_ERROR.CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE - // [cfe] Type 'String' of the case expression is not a subtype of type 'int' of this switch expression. - return 100; - } - return 0; -} diff --git a/tests/language/nonfunction_type_aliases/generic_usage_function_error_test.dart b/tests/language/nonfunction_type_aliases/generic_usage_function_error_test.dart index 2d809b763d5..6b8ed56b2b2 100644 --- a/tests/language/nonfunction_type_aliases/generic_usage_function_error_test.dart +++ b/tests/language/nonfunction_type_aliases/generic_usage_function_error_test.dart @@ -1,6 +1,8 @@ // 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. +// +// @dart=2.19 import 'dart:async'; diff --git a/tests/language/nonfunction_type_aliases/usage_function_error_test.dart b/tests/language/nonfunction_type_aliases/usage_function_error_test.dart index dd73fe7f1f6..314fdc4877b 100644 --- a/tests/language/nonfunction_type_aliases/usage_function_error_test.dart +++ b/tests/language/nonfunction_type_aliases/usage_function_error_test.dart @@ -1,6 +1,8 @@ // 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. +// +// @dart=2.19 // Introduce an aliased type. diff --git a/tests/language/switch/bad_case_test.dart b/tests/language/switch/bad_case_test.dart index 57e40a5d673..82e8b28078f 100644 --- a/tests/language/switch/bad_case_test.dart +++ b/tests/language/switch/bad_case_test.dart @@ -1,8 +1,11 @@ // Copyright (c) 2013, 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. +// +// @dart=2.19 -// Test reporting a compile-time error if case expressions are of type double. +// Test reporting a compile-time error if case expressions are of type double, +// prior to Dart 3.0 and patterns. import "package:expect/expect.dart"; diff --git a/tests/language/switch/case_expression_with_assignment_test.dart b/tests/language/switch/case_expression_with_assignment_test.dart index 76a4d38f574..58c3e43a846 100644 --- a/tests/language/switch/case_expression_with_assignment_test.dart +++ b/tests/language/switch/case_expression_with_assignment_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2017, 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. +// +// @dart=2.19 // Regression test for crash in VM parser (issue 29370). diff --git a/tests/language/switch/case_test.dart b/tests/language/switch/case_test.dart index 9432bc20911..5219aabb2e2 100644 --- a/tests/language/switch/case_test.dart +++ b/tests/language/switch/case_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2014, 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. +// +// @dart=2.19 import "package:expect/expect.dart"; diff --git a/tests/language/switch/case_warn_test.dart b/tests/language/switch/case_warn_test.dart index cf0a89687b7..7920255b5df 100644 --- a/tests/language/switch/case_warn_test.dart +++ b/tests/language/switch/case_warn_test.dart @@ -2,6 +2,8 @@ // 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. // Test switch statement. +// +// @dart=2.19 // Tests some switch-case statements blocks that should and should not // cause static warnings. diff --git a/tests/language/switch/empty_block_case_test.dart b/tests/language/switch/empty_block_case_test.dart index 98227e4d754..61019813285 100644 --- a/tests/language/switch/empty_block_case_test.dart +++ b/tests/language/switch/empty_block_case_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2011, 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. +// +// @dart=2.19 import "package:expect/expect.dart"; diff --git a/tests/language/switch/fallthru_test.dart b/tests/language/switch/fallthru_test.dart index 95fb7dbdf4b..180d44f2cde 100644 --- a/tests/language/switch/fallthru_test.dart +++ b/tests/language/switch/fallthru_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2011, 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. +// +// @dart=2.19 import "package:expect/expect.dart"; diff --git a/tests/language/unsorted/assignable_expression_test.dart b/tests/language/unsorted/assignable_expression_test.dart index 5bd904c4cb1..aa9219babe6 100644 --- a/tests/language/unsorted/assignable_expression_test.dart +++ b/tests/language/unsorted/assignable_expression_test.dart @@ -1,6 +1,8 @@ // Copyright (c) 2013, 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. +// +// @dart=2.19 // Test to detect syntactically illegal left-hand-side (assignable) // expressions.