@@ -8,6 +8,7 @@ import com.intellij.openapi.util.Key
88import com.intellij.psi.PsiElementVisitor
99import com.jetbrains.python.codeInsight.typing.matchingProtocolDefinitions
1010import com.jetbrains.python.documentation.PythonDocumentationProvider
11+ import com.jetbrains.python.inspections.PyInspectionVisitor
1112import com.jetbrains.python.inspections.PyTypeCheckerInspection
1213import com.jetbrains.python.psi.PyCallExpression
1314import com.jetbrains.python.psi.PyCallExpression.PyArgumentsMapping
@@ -27,11 +28,11 @@ class PydanticTypeCheckerInspection : PyTypeCheckerInspection() {
2728 if (LOG .isDebugEnabled) {
2829 session.putUserData(TIME_KEY , System .nanoTime())
2930 }
30- return Visitor (holder, session)
31+ return Visitor (holder, PyInspectionVisitor .getContext( session) )
3132 }
3233
33- class Visitor (holder : ProblemsHolder ? , session : LocalInspectionToolSession ) :
34- PyTypeCheckerInspection .Visitor (holder, session ) {
34+ class Visitor (holder : ProblemsHolder ? , context : TypeEvalContext ) :
35+ PyTypeCheckerInspection .Visitor (holder, context ) {
3536
3637 val pydanticConfigService = PydanticConfigService .getInstance(holder!! .project)
3738
@@ -103,7 +104,7 @@ class PydanticTypeCheckerInspection : PyTypeCheckerInspection() {
103104 private fun analyzeCallee (callSite : PyCallSiteExpression , mapping : PyArgumentsMapping ) {
104105 val callableType = mapping.callableType ? : return
105106 val receiver = callSite.getReceiver(callableType.callable)
106- val substitutions = PyTypeChecker .unifyReceiver (receiver, myTypeEvalContext)
107+ val substitutions = PyTypeChecker .unifyReceiverWithParamSpecs (receiver, myTypeEvalContext)
107108 val mappedParameters = mapping.mappedParameters
108109 val cachedParsableTypeMap = mutableMapOf<PyType , PyType ?>()
109110 val cachedAcceptableTypeMap = mutableMapOf<PyType , PyType ?>()
@@ -162,7 +163,7 @@ class PydanticTypeCheckerInspection : PyTypeCheckerInspection() {
162163 private fun matchParameterAndArgument (
163164 parameterType : PyType ? ,
164165 argumentType : PyType ? ,
165- substitutions : Map < PyGenericType , PyType > ,
166+ substitutions : PyTypeChecker . GenericSubstitutions ,
166167 ): Boolean {
167168 return PyTypeChecker .match(parameterType,
168169 argumentType,
0 commit comments