diff --git a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typeRepresentation/PyTypeRepresentationParser.kt b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typeRepresentation/PyTypeRepresentationParser.kt index a55a648ee846..45a552fb85dd 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typeRepresentation/PyTypeRepresentationParser.kt +++ b/python/python-psi-impl/src/com/jetbrains/python/codeInsight/typeRepresentation/PyTypeRepresentationParser.kt @@ -18,6 +18,7 @@ package com.jetbrains.python.codeInsight.typeRepresentation import com.intellij.lang.SyntaxTreeBuilder import com.intellij.openapi.util.NlsContexts import com.intellij.psi.tree.IElementType +import com.jetbrains.python.PYTHON_VERSION_ARG import com.jetbrains.python.PyElementTypes import com.jetbrains.python.PyParsingBundle import com.jetbrains.python.PyTokenTypes @@ -252,7 +253,7 @@ class PyTypeRepresentationParser : PyParser() { } namedVarargMarker.done(PyTypeRepresentationElementTypes.NAMED_PARAMETER_TYPE) } - else { + else if (atToken(PyTokenTypes.IDENTIFIER)) { // Unnamed *args, just parse the type parseExpression() } diff --git a/python/testData/typeRepresentation/parsing/ callable no type after star.txt b/python/testData/typeRepresentation/parsing/ callable no type after star.txt index b250a148d189..6f37595a1cb7 100644 --- a/python/testData/typeRepresentation/parsing/ callable no type after star.txt +++ b/python/testData/typeRepresentation/parsing/ callable no type after star.txt @@ -4,11 +4,7 @@ TypeRepresentation:a.pythonTypeRepresentation PsiElement(Py:LPAR)('(') PyStarExpression PsiElement(Py:MULT)('*') - PsiErrorElement:Unexpected token - - PsiElement(Py:RPAR)(')') - PsiErrorElement:')' expected - + PsiElement(Py:RPAR)(')') PsiWhiteSpace(' ') PsiElement(Py:RARROW)('->') PsiWhiteSpace(' ')