Skip to content

Commit 25bac04

Browse files
nshahancommit-bot@chromium.org
authored andcommitted
[tests] Delete temporary const tests
These tests acted as a guard to make sure we didn't unintentionally enable control flow and spread in const collections when we initially shipped the features. Now that we are getting close to enabling them for const they no longer valid. Added a few more compile-time errors to the const spread error suite. Change-Id: I52e215d4c1c4394f1a1b868c05241277b0d58d2a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108680 Reviewed-by: Bob Nystrom <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent f40aac1 commit 25bac04

File tree

3 files changed

+10
-51
lines changed

3 files changed

+10
-51
lines changed

tests/language_2/control_flow_collections/if_const_syntax_error_test.dart

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/language_2/spread_collections/const_error_test.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'helper_classes.dart';
1010

1111
var nonConstList = <int>[];
1212
var nonConstMap = <int, String>{};
13+
var nonConstSet = <int>{};
1314
const dynamic nonIterable = 3;
1415
const dynamic nonMap = 3;
1516

@@ -48,20 +49,22 @@ void testMap() {
4849
void testSet() {
4950
// Must be constant.
5051
const _ = <int>{...nonConstList}; //# 09: compile-time error
52+
const _ = <int>{...nonConstSet}; //# 10: compile-time error
5153

5254
// Must be iterable.
53-
const _ = <int>{...nonIterable}; //# 10: compile-time error
55+
const _ = <int>{...nonIterable}; //# 11: compile-time error
5456

5557
// Cannot be custom iterable type.
56-
const _ = <int>{...ConstIterable()}; //# 11: compile-time error
58+
const _ = <int>{...ConstIterable()}; //# 12: compile-time error
5759

5860
// Cannot override operator.==().
5961
const obj = 0.1;
60-
const _ = {...[0.1]}; //# 12: compile-time error
61-
const _ = {...[Duration(seconds: 0)]}; //# 13: compile-time error
62-
const _ = {...[obj]}; //# 14: compile-time error
62+
const _ = {...[0.1]}; //# 13: compile-time error
63+
const _ = {...[Duration(seconds: 0)]}; //# 14: compile-time error
64+
const _ = {...[obj]}; //# 15: compile-time error
6365

6466
// Cannot have collision.
65-
const _ = {1, ...[1]}; //# 15: compile-time error
66-
const _ = {...[1], ...[1]}; //# 16: compile-time error
67+
const _ = {1, ...[1]}; //# 16: compile-time error
68+
const _ = {...[1, 1, 3, 8]}; //# 17: compile-time error
69+
const _ = {...[1], ...[1]}; //# 18: compile-time error
6770
}

tests/language_2/spread_collections/const_syntax_error_test.dart

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)