mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-28076 Type of assignment target in parentheses is not inferred
GitOrigin-RevId: 457adb65fea311a169ae8fd4ca78a6915518b378
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f24e4f0fff
commit
4e2f6f2685
+1
-1
@@ -121,7 +121,7 @@ public class PyTargetExpressionImpl extends PyBaseElementImpl<PyTargetExpression
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
final PsiElement parent = getParent();
|
||||
final PsiElement parent = PsiTreeUtil.skipParentsOfType(this, PyParenthesizedExpression.class);
|
||||
if (parent instanceof PyAssignmentStatement assignmentStatement) {
|
||||
PyExpression assignedValue = assignmentStatement.getAssignedValue();
|
||||
if (assignedValue instanceof PyParenthesizedExpression) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
def func():
|
||||
var: [object]
|
||||
var: [str]
|
||||
(var) = 'spam'
|
||||
var
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
def func():
|
||||
(var) = 'spam' # type: [object]
|
||||
(var) = 'spam' # type: [str]
|
||||
var
|
||||
|
||||
@@ -4566,6 +4566,11 @@ public class PyTypeTest extends PyTestCase {
|
||||
expr = c.get()""");
|
||||
}
|
||||
|
||||
// PY-28076
|
||||
public void testAssignmentParens() {
|
||||
doTest("int", "((expr)) = 42");
|
||||
}
|
||||
|
||||
private static List<TypeEvalContext> getTypeEvalContexts(@NotNull PyExpression element) {
|
||||
return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
|
||||
TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());
|
||||
|
||||
Reference in New Issue
Block a user