mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
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>
23 lines
775 B
Dart
23 lines
775 B
Dart
// Copyright (c) 2012, 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.
|
|
|
|
final int x = 'foo';
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
|
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
|
const int y = 'foo';
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
|
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
|
int z = 'foo';
|
|
// ^^^^^
|
|
// [analyzer] COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
|
|
// [cfe] A value of type 'String' can't be assigned to a variable of type 'int'.
|
|
|
|
main() {
|
|
print(x);
|
|
print(y);
|
|
print(z);
|
|
}
|