Invalid type argument usage
Reports type variables used as arguments in locations that their variance does not allow, so long as they are not marked as unchecked. A type variable may have a variance of either covariant (out), contravariant (in), or invariant (neither out nor in).
The following rules are used to check the type arguments used in attribute and method declarations:
uncheckedtype arguments are ignored.Covariant type arguments may only be used in locations that produce values (for example, return types and block parameters).
Contravariant type arguments may only be used in locations that consume arguments (for example, parameters and block return types).
Invariant type arguments may be used in both locations that produce values and consume arguments.
Example:
class Example[in A, out B]
# Covariant type variable 'B' of class 'Example' used in a contravariant position, ...
def call: (B) -> A
end- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
RbsInvalidTypeArgumentUsage
Inspection ID: RbsInvalidTypeArgumentUsage
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
//noinspection RbsInvalidTypeArgumentUsagenote
Actual comment syntax will depend on the code language you are working with
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |