This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
[BUG] avoid-collection-methods-with-unrelated-types does not compare with dynamic #1108
Closed
Description
- Dart code metrics version: I use 4.16.0 because of my SDK version. Also verified on 5.2.1.
- Dart sdk version: 2.18.0
Please show your full configuration:
analysis_options.yaml
include: package:lints/recommended.yaml
analyzer:
plugins:
- dart_code_metrics
dart_code_metrics:
rules:
- avoid-collection-methods-with-unrelated-types
What did you do? Please include the source code example causing the issue.
class Awesome {
bool foo() {
dynamic a = 'hello';
final List<int> b = [1,2,3];
return b.contains(a); // LINT avoid-collection-methods-with-unrelated-types
}
}
What did you expect to happen?
I expected an OK, otherwise there is no use for dynamic
.
What actually happened?
linter warning, because a dynamic
is not an int
.
Are you willing to submit a pull request to fix this bug?
Sure, but I haven't looked in the code yet. I guess I would simply return OK when the type is dynamic
.