Files
sdk/pkg/cfg/testcases/expressions.dart
Alexander Markov ccbcd76265 [modular_aot] Records
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ie6ba4148ca9193b5b28de3d90efa7bb55427ef53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498660
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-18 08:03:32 -07:00

49 lines
1.0 KiB
Dart

// Copyright (c) 2026, 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.
void listLiterals<T>(T x) {
print([]);
print(<T>[]);
print([1, 2, 3]);
print([1, 2, 3, 4, 5, 6, 7, 8, 9]);
print(<T>[x, x, x, x, x, x, x, x, x]);
}
void mapLiterals<S, T>(S key, T Function() value, S key2, T value2) {
print({});
print(<S, T>{});
print({'a': 'aa', 'b': 'bb'});
print({key: value(), key2: value2});
}
void nullChecks(Object? x) {
print(x!);
Object? y;
if (1 != 2) {
y = 42;
}
print(y!);
}
void logical(bool x, bool Function() y, bool z) {
print(!x);
print(x || y());
print(y() && x);
print(!(x && (y() || z)));
}
void recordLiterals<T>(int a, String b, T c) {
print((a,));
print((a, bbb: b));
print((a, b, c));
}
void recordFields<T>((int, String) r1, (int, {T foo, T bar}) r2) {
print(r1.$2);
print(r2.$1);
print(r2.bar);
}
void main() {}