Files
sdk/tests/language_2/const/init2_test.dart
T
Sam Rawlins b8ce4baf7e Remove 'checked mode' from checked_mode_compile_time_errors
Change-Id: I6576eb186149d540ce2dbc0e0aab7177ff4727be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-07-31 19:20:58 +00:00

18 lines
563 B
Dart

// Copyright (c) 2014, 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.
const intValue = 0;
const double c = 0.0;
const double d = intValue;
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.VARIABLE_TYPE_MISMATCH
// [cfe] A value of type 'int' can't be assigned to a variable of type 'double'.
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
main() {
print(c);
print(d);
}