-
Notifications
You must be signed in to change notification settings - Fork 1.7k
type parameter bounds for generic methods/functions #27256
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
Comments
From @jmesserly on April 28, 2016 20:36 (Note, if we ever want mirror support for type bounds, we'll need to store this in a way we can get at it. https://api.dartlang.org/stable/1.16.0/dart-mirrors/TypeVariableMirror-class.html -- that's pretty obscure though, unclear where mirrors is headed for DDC) |
From @jmesserly on April 28, 2016 23:23 Oh also: we'll need to instantiate to bounds at runtime in dcall/dsend. This is not implemented yet. |
Note, this also affects our ability to do subtype checks on the bounds given two generic function types.. |
This reverts commit b58f826. BUG= Review URL: https://codereview.chromium.org/2870543005 .
This reverts commit 3a23e60. The problem was unrelated to the CL; it appears to be a dart:async break of package:async. In the meantime we have turned on --unsafe-force-compile to DDC's shapshotting step Review-Url: https://codereview.chromium.org/2869733006 .
From @jmesserly on April 28, 2016 20:26
The initial implementation will not validate type bounds.
We actually have the same issue with generic classes. But there, it can only be triggered via JavaScript interop, because
C<InvalidType>
would be rejected at compile time. Generic methods must handle this at run time for dynamic calls.Since we represent these types as a function like
(T, S) => dart.functionType(...)
, once option is to generate an assertion in the body. Same trick would work for generic classes, although we might not want it there, because it would be triggered (once) for every class, whereas if we look up a runtime type signature of a generic method, we're already in the dynamic dispatch code path.Copied from original issue: dart-archive/dev_compiler#532
The text was updated successfully, but these errors were encountered: