Take this simple example:
class C<T> {
C._([int? x]);
}
void foo() {
C._(7);
}
analyzer reports int? x as an UNUSED_ELEMENT, citing that "a value for optional parameter 'x' isn't ever given." :cringe:.
The issue is that analyzer looks at a constructor invocation like C._(7), for a generic class, and performs inference, and replaces each ParameterElement with a fresh, synthetic, ParameterElement. Then the "corresponding parameter element" for 7 (the synthetic thing) is marked as used, and meanwhile the real ParameterElement is never marked used.
Take this simple example:
analyzer reports
int? xas an UNUSED_ELEMENT, citing that "a value for optional parameter 'x' isn't ever given." :cringe:.The issue is that analyzer looks at a constructor invocation like
C._(7), for a generic class, and performs inference, and replaces each ParameterElement with a fresh, synthetic, ParameterElement. Then the "corresponding parameter element" for7(the synthetic thing) is marked as used, and meanwhile the real ParameterElement is never marked used.