mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-83597 False positive type narrowing in expressions with "and"
GitOrigin-RevId: e39cae3490ef0f0f151842f428a45d14d2c4d9ed
This commit is contained in:
committed by
intellij-monorepo-bot
parent
acba8a231a
commit
663b57857e
@@ -151,6 +151,32 @@ public class Py3TypeTest extends PyTestCase {
|
||||
expr = d.pop("abc", None)""");
|
||||
}
|
||||
|
||||
// PY-83351
|
||||
public void testWhileStatementNarrowing() {
|
||||
doTest("int",
|
||||
"""
|
||||
def foo(x: int | None):
|
||||
while x:
|
||||
expr = x
|
||||
x = None
|
||||
""");
|
||||
doTest("int",
|
||||
"""
|
||||
def foo(x: int | None):
|
||||
while not (not (((not (not x))))):
|
||||
expr = x
|
||||
x = None
|
||||
""");
|
||||
}
|
||||
|
||||
// PY-83597
|
||||
public void testAndExpressionNarrowing() {
|
||||
doTest("int", """
|
||||
def foo(x: int | None):
|
||||
x and (expr := x)
|
||||
""");
|
||||
}
|
||||
|
||||
// PY-83348
|
||||
public void testOrExpressionType() {
|
||||
doTest("int | str", """
|
||||
|
||||
Reference in New Issue
Block a user