-
Notifications
You must be signed in to change notification settings - Fork 27
generic method types not transferred to constructor calls #433
Comments
Nice catch! It looks like you're using Dart VM? Sadly there's not a lot we can do there, until generic methods support is added to the language spec. (A related issue: DDC hasn't implemented #301 yet, so it doesn't pass "A" and "B" to If you'd be willing to run your command line program using DDC and node.js, we can support it sooner. Would that work? Cheers & thanks for the excellent (as usual) bug report :) |
ahhh it appears I am confused. I thought this was all part of a dart wide initiative to add support for generic methods. In this project I have a polymer dart front end and shelf dart backend. I am adding generic methods to improve code quality by increasing the feedback I get from the analyzer. I'm not expecting to make any particular use of the ddc for this project (although it will be huge for my chances of sneaking in more dart code at work ;-)). The errors I got were from running I had naively assumed that the vm was parsing the // style generics too and that it was just a way to test out generic methods in Dart before finally committing to them in the language spec. I guess that means I should do less guessing and more asking :-/ oh well I guess I need to figure out what to do with all the generic method code I just added. I may still be able to keep it but go with the |
Oh, we're definitely working towards generic methods. Analyzer strong mode + DDC is the testing grounds for the enhancement proposal. DDC has a sound type system so we need them sooner than other Dart impls do. We were hoping that the static type checking would be useful on its own, without necessarily having the runtime checking yet. In current Dart, if you have something that's conceptually a generic method, and it should return something like Iterable< T >, you'll always get Iterable< dynamic > at runtime. Adding static type checking, without the runtime checks, might help catch some bugs at analysis time. But yeah, when using the comments, it won't affect behavior at runtime, so you won't catch any new bugs there. |
ah thanks for clarifying. That is great news. So it is just a matter for me and others to get a handle on where the boundaries lie. I had fooled myself into thinking that the
But I see now that it is not the case in general, only for stuff compiled by the dcc (and to some extent the analyser). Thanks for taking the time to clear things up |
This is a nice example. We may want to disallow this sort of syntax: |
this is now tracked at dart-lang/sdk#25637 |
In the example below neither instance of
Fred
ends up with the expected type arguments.f1
ends up asFred<List, Object>
andf2
as justFred
resulting output
The text was updated successfully, but these errors were encountered: