-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
We get 1668 errors when using implicit-casts: false today.
I looked at some of them and found the following broad issues:
-
We often have variables of type
dynamic, which we then pass to methods that expect particular types. I think we want this to do a type check at runtime then cast automatically. The point ofdynamicis that it opts you out of static typing. -
We have methods that take type arguments, do a search of a tree or Map or whatnot, then return an instance of the given type. The call sites assume the type is correct. Today, they take their type as a regular argument, and the return type is therefore not as tight as it could be. We would switch to generic type arguments to pass the type (allowing us to set the return type correctly), but the VM doesn't reify the types and we therefore couldn't actually do the search.
-
701 of the errors go away if we set
declaration-casts: false. These are places where, once we have strong mode in the VM, we will be usingasinstead of assignments. -
double x = 0.0.clamp(0.0, 0.0);doesn't work becausedoublereturnsnum. -
Stream.firstWherereturns aFuture<dynamic>instead of aFuture<T>. -
There's probably others. With 1668 errors to go through, I could only sample the problems, and 1, 2, and 3 above are very common indeed so they swamp out the others.