diff options
Diffstat (limited to 'python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java')
-rw-r--r-- | python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java index 346d40f3273e..c28bc29455c9 100644 --- a/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java +++ b/python/src/com/jetbrains/python/codeInsight/stdlib/PyStdlibTypeProvider.java @@ -36,6 +36,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import static com.jetbrains.python.psi.PyUtil.as; + /** * @author yole */ @@ -132,6 +134,23 @@ public class PyStdlibTypeProvider extends PyTypeProviderBase { } } } + else if ("__builtin__.tuple.__add__".equals(qname) && callSite instanceof PyBinaryExpression) { + final PyBinaryExpression expression = (PyBinaryExpression)callSite; + final PyTupleType leftTupleType = as(context.getType(expression.getLeftExpression()), PyTupleType.class); + if (expression.getRightExpression() != null) { + final PyTupleType rightTupleType = as(context.getType(expression.getRightExpression()), PyTupleType.class); + if (leftTupleType != null && rightTupleType != null) { + final PyType[] elementTypes = new PyType[leftTupleType.getElementCount() + rightTupleType.getElementCount()]; + for (int i = 0; i < leftTupleType.getElementCount(); i++) { + elementTypes[i] = leftTupleType.getElementType(i); + } + for (int i = 0; i < rightTupleType.getElementCount(); i++) { + elementTypes[i + leftTupleType.getElementCount()] = rightTupleType.getElementType(i); + } + return PyTupleType.create(function, elementTypes); + } + } + } } return null; } |