blob: bec649f39a7bddcae9609192d7b346d6c692228a [file] [log] [blame]
// Copyright (c) 2019, 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 main() {
bool? nullBool;
var a = <int>[if (nullBool) 1];
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'.
var b = <int, int>{if (nullBool) 1: 1};
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'.
var c = <int>{if (nullBool) 1};
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.UNCHECKED_USE_OF_NULLABLE_VALUE
// [cfe] A value of type 'bool?' can't be assigned to a variable of type 'bool'.
}