forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst_evaluation_A01_t01.dart
59 lines (47 loc) · 1.51 KB
/
const_evaluation_A01_t01.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2020, 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.
/// @assertion With sound null safety, all generic const constructors and
/// generic const literals are evaluated using the actual type arguments
/// provided, whether legacy or non-legacy. This ensures that with sound null
/// safety, the final consistent semantics are obeyed.
///
/// @description Checks statically that actual generic class type parameter is
/// evaluated correctly for [int?] type argument.
///
/// @author [email protected]
import "dart:async";
class A<T> {
const A();
}
main() {
const A<int?> a1 = A<int?>();
const A<int > a2 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<Object?> a3 = A<int?>();
const A<Object > a4 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<Function?> a5 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<Function > a6 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<dynamic> a7 = A<int?>();
const A<Null> a8 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<void> a9 = A<int?>();
const A<Never> a10 = A<int?>();
// ^
// [analyzer] unspecified
// [cfe] unspecified
const A<FutureOr> a11 = A<int?>();
}