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
Zone-tests should use generic methods #121
Comments
It seems to me that there is something wrong with return type of registerXXXCallback parameter value (which is function), <R>(Zone self, ZoneDelegate parent, Zone zone, R f()) => () => 42 as R
<R, T>(Zone self, ZoneDelegate parent, Zone zone, R f(T arg)) => (_) => 42 as R
<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)) => (_, __) => 42 as R I think it should be changed to ZoneCallback<R>(Zone self, ZoneDelegate parent, Zone zone, R f()) => () => 42 as R
ZoneUnaryCall<R, T>(Zone self, ZoneDelegate parent, Zone zone, R f(T arg)) => (_) => 42 as R
ZoneBinaryCallback<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)) => (_, __) => 42 as R @floitschG, do you agree? |
The <R>(Zone self, ZoneDelegate parent, Zone zone, R f()) => () => 42 as R This is a function that takes a generic argument The return type of the closure is "closure that returns R" -> If I wrote this function non-inline it would look like this: ZoneCallback<R> registerFunction<R>(Zone self, ZoneDelegate parent, Zone zone, R f()) {
return () => 42 as R;
} Feel free to write the test this way. It's probably easier to read. |
The initial proposal causes the dart analyzer to report an error:
|
I'm currently reworking the zones so that they are strong mode clean. In the future, arguments to the ZoneSpecification will require generic closures (for some arguments).
In particular, the following tests are affected:
Since the current specification ignores generic arguments, it should be safe to apply the changes already now.
Specifically, they need to be changed as follows:
The text was updated successfully, but these errors were encountered: