Describe the bug
If an asynchronous function is called with a type in the code, a plugin error
In this case python code no valid, but it raise plugin exception
To Reproduce
import asyncio
async def my_func(var: int):
return var + 1
async def main():
var = 1
await my_func(var: int) # This line raise plugin exception
asyncio.run(main())
Environments (please complete the following information):
Additional context
java.lang.Throwable: await my_func(var: int
parent=var = 1
await my_func(var: int)
asyncio.run(main())
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:202)
at com.intellij.psi.impl.PsiElementBase.notNullChild(PsiElementBase.java:284)
at com.intellij.psi.impl.PsiElementBase.findNotNullChildByClass(PsiElementBase.java:307)
at com.jetbrains.python.PyTypeDeclarationStatementImpl.getTarget(PyTypeDeclarationStatementImpl.java:38)
at com.jetbrains.python.codeInsight.controlflow.PyControlFlowBuilder.visitPyTypeDeclarationStatement(PyControlFlowBuilder.java:207)
at com.jetbrains.python.PyTypeDeclarationStatementImpl.acceptPyVisitor(PyTypeDeclarationStatementImpl.java:55)
at com.jetbrains.python.psi.impl.PyBaseElementImpl.accept(PyBaseElementImpl.java:61)
at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:58)
at com.jetbrains.python.psi.PyRecursiveElementVisitor.visitElement(PyRecursiveElementVisitor.java:12)
at com.jetbrains.python.psi.PyElementVisitor.visitPyElement(PyElementVisitor.java:26)
at com.jetbrains.python.codeInsight.controlflow.PyControlFlowBuilder.visitPyElement(PyControlFlowBuilder.java:131)
at com.jetbrains.python.psi.PyElementVisitor.visitPyStatementList(PyElementVisitor.java:198)
at com.jetbrains.python.psi.impl.PyStatementListImpl.acceptPyVisitor(PyStatementListImpl.java:23)
at com.jetbrains.python.psi.impl.PyBaseElementImpl.accept(PyBaseElementImpl.java:61)
at com.intellij.psi.impl.PsiElementBase.acceptChildren(PsiElementBase.java:58)
at com.intellij.codeInsight.controlflow.ControlFlowBuilder.visitFor(ControlFlowBuilder.java:283)
at com.intellij.codeInsight.controlflow.ControlFlowBuilder.build(ControlFlowBuilder.java:276)
at com.jetbrains.python.codeInsight.controlflow.PyControlFlowBuilder.buildControlFlow(PyControlFlowBuilder.java:54)
at com.jetbrains.python.codeInsight.controlflow.ControlFlowCache.getControlFlow(ControlFlowCache.java:44)
at com.jetbrains.python.codeInsight.controlflow.ControlFlowCache.getControlFlow(ControlFlowCache.java:52)
at com.jetbrains.python.refactoring.PyDefUseUtil.getLatestDefs(PyDefUseUtil.java:46)
at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeByControlFlow(PyReferenceExpressionImpl.java:512)
at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getQualifiedReferenceTypeByControlFlow(PyReferenceExpressionImpl.java:329)
at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getQualifiedReferenceType(PyReferenceExpressionImpl.java:286)
at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getType(PyReferenceExpressionImpl.java:223)
at com.jetbrains.python.psi.types.TypeEvalContext.lambda$getType$0(TypeEvalContext.java:176)
at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:112)
at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:42)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:66)
at com.jetbrains.python.psi.types.TypeEvalContext.getType(TypeEvalContext.java:165)
at com.koxudaxi.pydantic.PydanticKt.getType(Pydantic.kt:136)
at com.koxudaxi.pydantic.PydanticKt.getPyClassByPyCallExpression(Pydantic.kt:144)
at com.koxudaxi.pydantic.PydanticKt.getPydanticPyClass(Pydantic.kt:508)
at com.koxudaxi.pydantic.PydanticKt.getPydanticPyClass$default(Pydantic.kt:507)
at com.koxudaxi.pydantic.PydanticAnnotator.annotatePydanticModelCallableExpression(PydanticAnnotator.kt:22)
at com.koxudaxi.pydantic.PydanticAnnotator.visitPyCallExpression(PydanticAnnotator.kt:17)
at com.jetbrains.python.psi.impl.PyCallExpressionImpl.acceptPyVisitor(PyCallExpressionImpl.java:27)
at com.jetbrains.python.psi.impl.PyBaseElementImpl.accept(PyBaseElementImpl.java:61)
at com.jetbrains.python.validation.PyAnnotator.annotateElement(PyAnnotator.java:44)
at com.jetbrains.python.validation.PyAnnotatingVisitor.runAnnotators(PyAnnotatingVisitor.java:59)
at com.jetbrains.python.validation.PyCompositeAnnotator.annotate(PyCompositeAnnotator.java:15)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:131)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:108)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:344)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$7(GeneralHighlightingPass.java:277)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:304)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:307)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:93)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:307)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:274)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:222)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:97)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:379)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1111)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:371)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:370)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:346)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:173)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:182)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:344)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too