-
Notifications
You must be signed in to change notification settings - Fork 27
Static type of "(x) => null" is computed as "(dynamic) => <bottom>" #47
Comments
@vsmenon does this still reproduce? |
Yes, here's a repro: void foo() {
var f = (x) => null;
f = (x) => "hello";
} generates:
|
It looks like this is our inference. In some cases, like local var inference, we're careful not to accept bottom type. However this logic doesn't kick in consistently. I'm guessing lambda expression return type and return statements have this problem. Upwards generic methods I think is okay, as we reject "bottom", which can happen sometimes naturally as a result of computing the lower/upper bounds. (edit: can confirm that upwards inference explicitly rejects bottom, |
BTW, bottom comes into play as the type of |
haven't figured this out entirely, but my guess is that the static type () -> ⊥ for |
This should be (dynamic) => dynamic per spec as I understand it. Not sure if this is the analyzer or our mods to it.
@leafpetersen @bwilkerson @sigmundch
The text was updated successfully, but these errors were encountered: