sdk
sdk copied to clipboard
[analyzer] Expression.staticParameterElement should not be null for method with generics
Follow up on dart-lang/linter#2530
On the following example functionExpression.staticParameterElement.library is null for the generic case ff but not for f. Both should be set with a non-null variable.
class MyMap<K, V> {
void f(void Function(int a) p) {}
void ff(void Function(K a) p) {}
}
m() {
MyMap().f((int? a) {}); // staticParameterElement.library is correctly set
MyMap().ff((Object? a) {}); // staticParameterElement.library is null
}
(with analyzer-1.5.0)
/cc @scheglov
This issue still exist in analyzer-4.3.1. I just faced it again in https://github.com/dart-lang/linter/pull/3568#discussion_r935636271