From 82e63e7295ee18aea12f6373725b06f19d93d592 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Tue, 22 Nov 2016 21:39:08 +0300 Subject: [PATCH] Update PyTypeParser to use PyTypeUtil.toPositionalContainerType and PyTypeUtil.toKeywordContainerType while parsing PEP-484 function type comment --- .../jetbrains/python/psi/types/PyTypeParser.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeParser.java b/python/src/com/jetbrains/python/psi/types/PyTypeParser.java index 5d282e0cc4a3..1362b02bb671 100644 --- a/python/src/com/jetbrains/python/psi/types/PyTypeParser.java +++ b/python/src/com/jetbrains/python/psi/types/PyTypeParser.java @@ -411,19 +411,16 @@ public class PyTypeParser { return paramResult; } else if (starCount == 1) { - final PyClassType tupleType = PyTupleType.createHomogeneous(anchor, type); - if (tupleType != null) { - return paramResult.withType(tupleType); + final PyTupleType positionalType = PyTypeUtil.toPositionalContainerType(anchor, type); + if (positionalType != null) { + return paramResult.withType(positionalType); } return EMPTY_RESULT; } else if (starCount == 2) { - final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(anchor); - final PyClassType dictType = builtinCache.getDictType(); - if (dictType != null) { - final PyClass pyClass = dictType.getPyClass(); - return paramResult.withType(new PyCollectionTypeImpl(pyClass, false, - Arrays.asList(builtinCache.getStrType(), type))); + final PyCollectionType keywordType = PyTypeUtil.toKeywordContainerType(anchor, type); + if (keywordType != null) { + return paramResult.withType(keywordType); } return EMPTY_RESULT; }