mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Improve some diagnostic documentation
This recpatures some documentation lost in https://dart-review.googlesource.com/c/sdk/+/129833. Change-Id: Ie8355533bd0c42360c9d7dd2138813c83391d7c5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134981 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
5244d99a5d
commit
d0e779ff71
|
@ -7060,10 +7060,15 @@ class StaticTypeWarningCode extends AnalyzerErrorCode {
|
|||
// is used and type arguments are provided, but the number of type arguments
|
||||
// isn't the same as the number of type parameters.
|
||||
//
|
||||
// The analyzer also produces this diagnostic when a constructor is invoked
|
||||
// and the number of type arguments doesn't match the number of type
|
||||
// parameters declared for the class.
|
||||
//
|
||||
// #### Examples
|
||||
//
|
||||
// The following code produces this diagnostic because `C` has one type
|
||||
// parameter but two type arguments are provided:
|
||||
// parameter but two type arguments are provided when it is used as a type
|
||||
// annotation:
|
||||
//
|
||||
// ```dart
|
||||
// class C<E> {}
|
||||
|
@ -7071,6 +7076,15 @@ class StaticTypeWarningCode extends AnalyzerErrorCode {
|
|||
// void f([!C<int, int>!] x) {}
|
||||
// ```
|
||||
//
|
||||
// The following code produces this diagnostic because `C` declares one type
|
||||
// parameter, but two type arguments are provided when creating an instance:
|
||||
//
|
||||
// ```dart
|
||||
// class C<E> {}
|
||||
//
|
||||
// var c = [!C<int, int>!]();
|
||||
// ```
|
||||
//
|
||||
// #### Common fixes
|
||||
//
|
||||
// Add or remove type arguments, as necessary, to match the number of type
|
||||
|
|
|
@ -6737,10 +6737,15 @@ The analyzer produces this diagnostic when a type that has type parameters
|
|||
is used and type arguments are provided, but the number of type arguments
|
||||
isn't the same as the number of type parameters.
|
||||
|
||||
The analyzer also produces this diagnostic when a constructor is invoked
|
||||
and the number of type arguments doesn't match the number of type
|
||||
parameters declared for the class.
|
||||
|
||||
#### Examples
|
||||
|
||||
The following code produces this diagnostic because `C` has one type
|
||||
parameter but two type arguments are provided:
|
||||
parameter but two type arguments are provided when it is used as a type
|
||||
annotation:
|
||||
|
||||
{% prettify dart %}
|
||||
class C<E> {}
|
||||
|
@ -6748,6 +6753,15 @@ class C<E> {}
|
|||
void f([!C<int, int>!] x) {}
|
||||
{% endprettify %}
|
||||
|
||||
The following code produces this diagnostic because `C` declares one type
|
||||
parameter, but two type arguments are provided when creating an instance:
|
||||
|
||||
{% prettify dart %}
|
||||
class C<E> {}
|
||||
|
||||
var c = [!C<int, int>!]();
|
||||
{% endprettify %}
|
||||
|
||||
#### Common fixes
|
||||
|
||||
Add or remove type arguments, as necessary, to match the number of type
|
||||
|
|
Loading…
Reference in a new issue