blob: 016fff5f3aa8990e96f196c562d929fa2bc32fb1 [file] [log] [blame]
// 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.
// Tests elimination of null checks.
class A {
String? nonNullable;
String? nullable;
String? alwaysNull;
A({this.nonNullable, this.nullable, this.alwaysNull});
testNonNullable(A a) => a.nonNullable!;
testNullable(A a) => a.nullable!;
testAlwaysNull(A a) => a.alwaysNull!;
unused() => A(nonNullable: null, alwaysNull: 'abc');
A staticField = A(nonNullable: 'hi', nullable: 'bye');
void main() {
final list = [
A(nonNullable: 'foo', nullable: null, alwaysNull: null),
for (A a in list) {