13704520a0
Closes #43592. Bug: https://github.com/dart-lang/sdk/issues/43592 Change-Id: Ib57a70526a39a7125238546f08e1a2e97c279f0b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168860 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
22 lines
1.0 KiB
Dart
22 lines
1.0 KiB
Dart
// 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' because 'bool?' is nullable and 'bool' isn't.
|
|
|
|
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' because 'bool?' is nullable and 'bool' isn't.
|
|
|
|
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' because 'bool?' is nullable and 'bool' isn't.
|
|
}
|