Erik Ernst

Results 1003 comments of Erik Ernst

```dart void bar(List? list) { var newList = list ?? []; newList.expectStaticType; for (var value in list ?? []) { if (1 > 2) value.argleBargle; } } void main() {}...

Correction, the type argument of the iterable is actually already inferred as `Object?`: ```dart X whateverYouWant() { print(X); throw "Can't really return an arbitrary `X`"; } void main() { for...

It's not exactly the same situation. #4516 is concerned with the situation where the `??` expression has an empty context, the left hand operand of `??` has a type `T`,...

I guess we could play around with an idea like the following: > With a for-in statement of the form `for (W v in iter)` where `W` is `final` or...

Yes, changing `list ?? []` to `newList = list ?? []` in the for-in statement will also change the context type for `list ?? []` to `_`, and the type...

One thing will break: ```dart void main() { for (final _ in {}) {} // Error! } ``` The problem is that `{}` infers as a map when it occurs...

> This also breaks for some reason: This one fails because the standard upper bound of `List` and `Set` is `Object` (see [this topic](https://github.com/dart-lang/language/issues?q=is%3Aissue%20state%3Aopen%20label%3Aleast-upper-bound) which has lots of discussions about...

The last remaining questions about this behavior have been clarified in https://github.com/dart-lang/sdk/issues/62200. The crucial point is that the type of an ifNull-expression (`e1 ?? e2`) with a context type schema...

I'll just remain aware of this work, perhaps adding a comment now and then, but not do regular full reviews.

No focus in the editor on load still happens every time (Sep 2025). I believe the 'initial code' is being shown as it should. However, I've just noticed a keyboard...