-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Spurious compiler output when running Flutter tests #34031
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
I imagine that flutter-specific compiler output filtering should be done in flutter engine frontend server, so dart commit would stay, but frontend server is extended with "quiet" mode. |
This can be seen in the following reduced case: import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
abstract class Foo {
void bar(int value);
}
class MockFoo extends Mock implements Foo {}
void main() {
test('wat?', () {
Foo foo = new MockFoo();
foo.bar(2);
var value = verify(foo.bar(captureAny)).captured.single;
expect(value, 2);
});
} This produces the following output:
This is showing up in Fuchsia builds as well. |
That code is indeed pretty dubious (you're not supposed to be able to pass a |
cc @devoncarew |
@MichaelRFairhurst, is this working as intended, or an analyzer bug? |
What about: verify<void>(foo.bar(captureAny))... 😉 |
That's pointless code. The argument can't be used. |
That's not true. A void value cannot be used, so the argument cannot be used in the function.
Void values are values with a bit saying "do not use." Its perfectly safe to provide any value to f(), including a void value. As opposed to Object, which cannot accept a void value but can accept everything else:
We considered making the third option illegal, but there was no evidence it offered anything of value (no theoretical basis nor data suggesting so) and it would have been a change to mockito's API that would have had a less readable end result. This was reported in the original flutter-dev post about void: https://groups.google.com/forum/#!searchin/flutter-dev/void$20mockito%7Csort:date/flutter-dev/scnh7SfYa_o/Mcqv70L6AAAJ
I am working on a blog post that explains all this stuff better in one clear concise place.
This is a CFE bug, the analyzer is working correctly. |
I agree with Ian's original opinion it could be reverted. It was reverted
originally, (I reverted it), due to known issues such as this one. It was
then relanded as warnings with the intention that the known issues would be
fixed. However they are still not fixed so that indicates to me that this
should not have been rolled forward, it disincentivizes the fix. The issues
here are part of a really complex topic and we risk causing a lot of
confusion/alienation here. Making users "fix" code we intentionally wanted
them to keep. Also there is no obvious workaround for this mockito case. I
wish it hadn't been part of Dart 2 Stable but it should definitely be fixed
by 2.1.
…On Sat, Aug 11, 2018, 11:52 PM Ian Hickson ***@***.***> wrote:
That's pointless code. The argument can't be used.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34031 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABjWe_fiiABs6WoU3yuNq7qJ9xp7NqY5ks5uP9DAgaJpZM4VnZNT>
.
|
cc @kmillikin |
This is due to incorrect handling of void types. Closing in favor of #30470 which has some more discussion. |
These warnings should be gone with 9bdf248. How can we verify that? |
Once current dart->engine->flutter roll lands, we could confirm that flutter test run doesn't produce that diagnostic. |
IMHO https://dart-review.googlesource.com/c/sdk/+/66160 should be reverted. It's causing spurious warnings when running Flutter's tests:
By "spurious" I mean that they are messages that the analyzer is not reporting, and that the code works fine.
IMHO the compiler should never output any messages except if it has a fatal error. The analyzer is the tool whose role it is to report problems, not the compiler.
cc @aam @peter-ahe-google
The text was updated successfully, but these errors were encountered: