-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Flaky avoid_redundant_argument_values lint #49596
Comments
This whole investigation was triggered because in flutter we removed a bunch of [1] flutter/flutter#108924 |
@scheglov I sat with @goderbauer as he reproduced the flakiness in the IDE. I think this is a really good repro (at least on his machine with a large workspace open in IntelliJ). The diagnostic would remain in the Diagnostics panel for a while (~a minute; seemingly stable) while we kept |
Interesting. When I restart DAS, there is never any hint on What should happen here? The parameter is nullable, so passing |
I think there should be no hint here. |
not getting the hint would be great |
If I had a choice between correcting the hint and correcting the flakiness, I would choose the latter 😛 |
Well, now I got it to the state when we always report the hint :-D |
The main issue is that when looking from a legacy library, we consider So, I'm not sure how to make that it does not report the lint. |
A solution could be to update the lint rule so that it checks that the declaration of the parameter it required. if (param.declaration.isRequired || param.hasRequired) {
continue;
} |
@pq Not sure about the semantics here. |
https://dart-review.googlesource.com/c/sdk/+/253705 will update the analyzer to evaluate default values, so unflake it. |
Is there a test case I can use to reproduce this in our reflective tests? Maybe once a deflaked analyzer is published? |
Here is what I used locally. @reflectiveTest
class ZZZTest extends PubPackageResolutionTest {
solo_test_XXX() async {
writeTestPackageAnalysisOptionsFile(
AnalysisOptionsFileConfig(
lints: ['avoid_redundant_argument_values'],
),
);
final a = newFile('$testPackageLibPath/a.dart', r'''
class Foo {
int? foo;
Foo({required this.foo});
}
''');
final b = newFile('$testPackageLibPath/b.dart', r'''
// @dart = 2.9
import 'a.dart';
void f() {
Foo(foo: null);
}
''');
// Uncomment to get the lint reported.
// await resolveFile2(a.path);
await resolveFile2(b.path);
assertNoErrorsInResult(); // does not matter, just to see if there are or not diagnostics
}
} |
…. required named). Bug: #49596 Change-Id: Id9696a6e93499ec4eca164ccb78c39aec5acaaab Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253705 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
FYI, https://dart-review.googlesource.com/c/sdk/+/253705 landed, and breaks Flutter at least once.
|
It's complaining about this line here: But |
True, as I described above, my change it to make it not flake. |
This is a little strange and doesn't reproduce consistently, but I'll try to provide as much details as I have. In IntelliJ I have a workspace that has a bunch of projects open (including the flutter repository). In this one, I also have a tiny playground project with two files:
foo.dart:
main.dart:
Now, sometimes I see what appears to be an incorrect
avoid_redundant_argument_values
warning on the line with the 🔥. The warning doesn't show up consistently. Sometimes it doesn't show up at all, sometimes it shows up for 5s to 10s and then disappears. Sometimes it sticks around indefinitely until I edit the code again. It's a bit of a mystery.Here are random changes I have made to the files to make the warning appear/disappear (I believe the warning is incorrect in all cases):
foo
field toint?
Bar?
@dart
directive from main.dart@dart
directive back inThe text was updated successfully, but these errors were encountered: