Closed
Description
When migrating the below code to NNBD using pkg/dev_compiler/tool/check_nnbd_sdk.dart tool, the analyzer produces a warning (requires an explicit cast)
const int DAYS_IN_4_YEARS = 4 * 365 + 1;
const int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
const int DAYS_IN_100_YEARS = 25 * DAYS_IN_4_YEARS - 1;
const int DAYS_IN_400_YEARS = 4 * DAYS_IN_100_YEARS + 1;
const int daysSince1970 = 200;
const in DAYS_IN_400_YEARS
int days = daysSince1970;
days = days.remainder(DAYS_IN_400_YEARS);
ERROR|STATIC_TYPE_WARNING|INVALID_ASSIGNMENT|lib/core/core.dart|2092|12|33|A value of type 'num' can't be assigned to a variable of type 'int'.
It requires the user to do an explicit cast which can be inefficient.
We need a mechanism that would not require the user to make an explicit cast here.
Metadata
Metadata
Assignees
Labels
No labels