Skip to content

Allow any to work with Strong mode #25

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

Closed
srawlins opened this issue Jun 9, 2016 · 1 comment
Closed

Allow any to work with Strong mode #25

srawlins opened this issue Jun 9, 2016 · 1 comment

Comments

@srawlins
Copy link
Member

srawlins commented Jun 9, 2016

This is a sibling issue to dart-lang/sdk#26036.

The issue is that we cannot use any with Strong mode turned on. For example:

int f(List<int> l) => l[0];

void main() {
  f(any);
}

Yields an analyzer error (dartanalyzer --strong a.dart): "Unsound implicit cast from dynamic to List".

I think we can solve this on the Mockito side, similar to Java Mockito's any().

I have a prototype implementation that uses the Strong mode type parameter comments:

/*=T*/ any/*<T>*/([/*=T*/ e = null]) => null;

The tricky part is that any would now return null, instead of the _ArgMatcher (again similar to Java Mockito's, and we would have to implement something like Java Mockito's reportMatcher(), maybe changing how the whole matching situation works...

What do you think? Any thoughts or other ideas?

@leafpetersen
Copy link
Member

@kevmoo Any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants