345d0f3a47
Avoid reporting an error if the static types are mismatched because CompileTimeErrorCode.INVALID_ASSIGNMENT would have already been reported by the ErrorVerifier. Closes #37238 Bug: https://github.com/dart-lang/sdk/issues/37238 Change-Id: I2248d054ed6bf6a546e998afb9b731a36e197780 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304362 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
16 lines
481 B
Dart
16 lines
481 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.INVALID_ASSIGNMENT
|
|
// [cfe] A value of type 'int' can't be assigned to a variable of type 'double'.
|
|
|
|
main() {
|
|
print(c);
|
|
print(d);
|
|
}
|