Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit b8996e3

Browse files
authored
tests for constructor tear-offs (#2903)
1 parent b4a1188 commit b8996e3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// test w/ `dart test -N unnecessary_const`
6+
7+
//ignore_for_file: unused_local_variable
8+
9+
class A {
10+
const A([o]);
11+
}
12+
13+
main() {
14+
const A(); // OK
15+
A(); // OK
16+
17+
A.new(); // OK
18+
const A.new(); // OK
19+
20+
const A([]); // OK
21+
A([]); // OK
22+
A(const []); // OK
23+
24+
const A(A()); // OK
25+
A(const A()); // OK
26+
A(A()); // OK
27+
28+
final v1 = A(); // OK
29+
const v3 = const A(); // LINT
30+
const v4 = A(); // OK
31+
final v5 = const A([]); // OK
32+
const v6 = const A([]); // LINT
33+
const v7 = A([]); // OK
34+
final v8 = A(const []); // OK
35+
final v9 = const A(const []); // LINT
36+
final v10 = const A([]); // OK
37+
final v11 = const A(const {}); // LINT
38+
final v12 = const A({}); // OK
39+
40+
const v13 = const A.new(); // LINT
41+
final v14 = A.new(const []); // OK
42+
final v15 = const A.new(const []); // LINT
43+
}

0 commit comments

Comments
 (0)