sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[analyzer] Expression.staticParameterElement should not be null for method with generics

Open a14n opened this issue 4 years ago • 1 comments

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

a14n avatar May 10 '21 06:05 a14n

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

a14n avatar Aug 03 '22 13:08 a14n