diff --git a/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/a.py b/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/a.py new file mode 100644 index 000000000000..8a0421f1dbcc --- /dev/null +++ b/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/a.py @@ -0,0 +1,9 @@ +from typing import Self +from m import Meta + + +class MyClass(metaclass=Meta): + def __new__(cls, p) -> Self: ... + + +expr = MyClass() diff --git a/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/m.py b/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/m.py new file mode 100644 index 000000000000..6d3434f8cc73 --- /dev/null +++ b/python/testData/inspections/PyArgumentListInspection/MetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile/m.py @@ -0,0 +1,4 @@ +class Meta(type): + def call(cls, *args, **kwargs) -> object: ... + + __call__ = call diff --git a/python/testSrc/com/jetbrains/python/inspections/Py3ArgumentListInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/Py3ArgumentListInspectionTest.java index 6f0c98b4640c..6d9b0af2d9c5 100644 --- a/python/testSrc/com/jetbrains/python/inspections/Py3ArgumentListInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/Py3ArgumentListInspectionTest.java @@ -421,6 +421,10 @@ public class Py3ArgumentListInspectionTest extends PyInspectionTestCase { """); } + public void testMetaclassDunderCallReturnTypeIncompatibleWithClassBeingConstructedMultiFile() { + doMultiFileTest(); + } + public void testMetaclassNotAnnotatedDunderCall() { doTestByText(""" from typing import Self