-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iterable.whereType returns everything in VM unless --preview-dart-2 #32423
Comments
@srawlins I think it only works in ... which is really confusing, to me. Owch! @leafpetersen |
Oh thank goodness.
Can I re-use this bug then to express my astonishment that SOME core lib 2 methods only work with
Can we maybe write something in CHANGELOG if we all have to live with this for a few months? |
I think |
We can also turn on reified generics outside of Dart 2 mode as a transitionary measure. WDYT @a-siva? |
you mean reified generic methods I guess, we could there maybe some surprises without type inference but otherwise it would be ok. |
The We will not have reified generics until Dart 2, but the current SDK is a Dart 2.0 development branch, so there are Dart 2 specific methods in it. Turning on reified generics in the VM only is likely to be confusing. It won't help code that gets compiled to JavaScript by dart2js, and it might even introduce errors in some cases. I'd just wait until we switch on the common front end so we have a level playing field for all backends. AFAIK we plan to change the default to enable Dart 2 features some time this month, so it shouldn't be long now. |
OK I don't want to complicate things. If --preview-dart-2 will become default on in a few weeks, maybe we just live with the surprise. Is it worth it to put something in the CHANGELOG? Will this confuse Flutter users? |
If you think it best, go ahead and put something in the CHANGELOG, though presumably we will want to take it out for the release (we're in a really weird state with the CHANGELOG). Alternatively, we could put an interim comment in the doc comment for whereType. |
@jakemac53 ran into this too, and in talking to him I got a little worried, not about the VM very much, but about dart2js. Externally, most people are running tests and running their code in the same mode, so if whereType doesn't work they'll see it in tests. But internally, people are testing with DDC and running with dart2js, which seems like a recipe for badness. @sigmundch How long before reification of generics is turned on in dart2js? @lrhn What do you think about making this method external and patching in a version which throws on dart2js? Alternatively, maybe we should just make it throw always for now? |
Ya this was pretty surprising to me when I ran across it. I have a somewhat crazy idea... would it be possible to add a check for |
It's about a month out or a bit more. |
This would be my preference: if |
That still leaves the vm in a really weird state which is why I suggested the other |
Just hit our first real world bug caused as a result of this, dart-lang/build#1123. (I added a usage of this before I was aware of how completely broken it is) |
cc @kevmoo |
I landed the CL disabling this whereType for now, and filed #32463 to track re-enabling it. Closing this. |
Thanks @leafpetersen ! |
I cannot get
whereType
to work on the VM. I haven't tried using dart2js or DDC. I tried with Lists, Sets, built-in types, and my own classes:The text was updated successfully, but these errors were encountered: