Skip to content

Compiler warning in Dart 2.1.0 when verifying void returning methods #163

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
v3rm0n opened this issue Aug 17, 2018 · 6 comments
Closed

Compiler warning in Dart 2.1.0 when verifying void returning methods #163

v3rm0n opened this issue Aug 17, 2018 · 6 comments

Comments

@v3rm0n
Copy link

v3rm0n commented Aug 17, 2018

Looks like Dart 2.1.0 has a change that generates a compiler warning when you are using a void returning expression inside a method call dart-lang/sdk@9eac90d

So

verify(cat.sleep());

Will cause

compiler message: test/src/cat_test.dart:94:35: Warning: This expression has type 'void' and can't be used.
compiler message:         verify(cat.sleep());
compiler message:                    ^
@MichaelRFairhurst
Copy link
Contributor

Thanks for filing! This is a known SDK bug: dart-lang/sdk#30470 (comment)

@MichaelRFairhurst
Copy link
Contributor

You can work around this warning by casting to dynamic (which is free):

verify(cat.sleep() as dynamic);

But you should not have to do this once the bug is fixed!

@srawlins
Copy link
Member

Dart 2.1.0 is not released yet. Which 2.1.0-dev version is this?

@MichaelRFairhurst
Copy link
Contributor

I think all of them

@kmillikin
Copy link

kmillikin commented Sep 5, 2018

This should be fixed by dart-lang/sdk@9bdf248. How can we verify that?

@srawlins
Copy link
Member

I think this has been fixed. We haven't bumped into this in over a year.

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

No branches or pull requests

4 participants