diff --git a/python/python-psi-impl/resources/inspectionDescriptions/PyVarianceInspection.html b/python/python-psi-impl/resources/inspectionDescriptions/PyVarianceInspection.html
index 12b6edfe0b68..bf0314d3f943 100644
--- a/python/python-psi-impl/resources/inspectionDescriptions/PyVarianceInspection.html
+++ b/python/python-psi-impl/resources/inspectionDescriptions/PyVarianceInspection.html
@@ -8,7 +8,7 @@
from typing import TypeVar, Generic
T = TypeVar("T", covariant=True)
class C(Generic[T]):
- def method(self, t: T): # at 'T': Incompatible variance: expected contravariant but was covariant
+ def method(self, t: T): # at 'T': A covariant type variable cannot be used in this contravariant position
pass
diff --git a/python/python-psi-impl/resources/messages/PyPsiBundle.properties b/python/python-psi-impl/resources/messages/PyPsiBundle.properties
index 6476fe03df7a..1ca421e2ef36 100644
--- a/python/python-psi-impl/resources/messages/PyPsiBundle.properties
+++ b/python/python-psi-impl/resources/messages/PyPsiBundle.properties
@@ -1269,7 +1269,7 @@ QFIX.NAME.unpack.type.var.tuple=Unpack the TypeVarTuple
# PyVarianceInspection
INSP.NAME.variance.checker=Incorrect variance
-INSP.variance.checker.incompatible=Incompatible variance: expected {0} but was {1}
+INSP.variance.checker.incompatible=A {1} type variable cannot be used in this {0} position
INSP.variance.checker.superfluous=Superfluous variance since the given constraints have no subtype relation
# PyInspectionsSuppressor
diff --git a/python/testSrc/com/jetbrains/python/PyVarianceTest.kt b/python/testSrc/com/jetbrains/python/PyVarianceTest.kt
index 4f43252a9968..be8697326ad1 100644
--- a/python/testSrc/com/jetbrains/python/PyVarianceTest.kt
+++ b/python/testSrc/com/jetbrains/python/PyVarianceTest.kt
@@ -80,7 +80,7 @@ internal class PyVarianceTest : PyTestCase() {
class Foo(Generic[T_co]):
def __init__(self, x: T_co) -> None: ... # allowed in __init__
- def do_smth(self, x: T_co) -> None: ...
+ def do_smth(self, x: T_co) -> None: ...
""")
}
@@ -109,7 +109,7 @@ internal class PyVarianceTest : PyTestCase() {
def foo(x: T_contra) -> T_contra: ...
class Foo(Generic[T_contra]):
- def do_smth(self, x: T_contra) -> T_contra: ...
+ def do_smth(self, x: T_contra) -> T_contra: ...
""")
}
@@ -122,7 +122,7 @@ internal class PyVarianceTest : PyTestCase() {
class Inv(Generic[T]):
...
- class Class1(Inv[T_co]):
+ class Class1(Inv[T_co]):
pass
inv = Inv[T_co]() # there should be no issue about incompatible variance here
@@ -150,7 +150,7 @@ internal class PyVarianceTest : PyTestCase() {
def __init__(self, x: T_contra):
pass
- def foo(self, x) -> T_contra: # False-negative
+ def foo(self, x) -> T_contra: # False-negative
pass
""")
}