rspec/rules/S4977/dart/rule.adoc

54 lines
957 B
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,dart,diff-id=1,diff-type=noncompliant]
----
class TypeParameterHidesAnotherType<T> {
T method<T> () { // Noncompliant
...
}
}
----
=== Compliant solution
[source,dart,diff-id=1,diff-type=compliant]
----
class NoTypeParameterHiding<T> {
U method<U> () {
...
}
}
----
== Resources
* Dart Docs - https://dart.dev/tools/linter-rules/avoid_shadowing_type_parameters[Dart Linter rule - avoid_shadowing_type_parameters]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
* The type parameter '<genericTypeParameterName>' shadows a type parameter from the enclosing [class|mixin|enum|extension|extension type].
=== Highlighting
The identifier of shadowing the type parameter.
'''
== Comments And Links
(visible only on this page)
endif::env-github,rspecator-view[]