PY-83348 Narrow X | None object to X after object or x

GitOrigin-RevId: d835132ade43a3f12b78f4029f584cad97180dc2
This commit is contained in:
Aleksandr.Govenko
2025-09-30 10:30:37 +00:00
committed by intellij-monorepo-bot
parent 4deee10799
commit acba8a231a
3 changed files with 23 additions and 2 deletions
@@ -150,6 +150,18 @@ public class Py3TypeTest extends PyTestCase {
d = {}
expr = d.pop("abc", None)""");
}
// PY-83348
public void testOrExpressionType() {
doTest("int | str", """
def foo(x: int | None):
expr = x or "foo"
""");
doTest("str", """
def foo(x: None):
expr = x or "foo"
""");
}
public void testYieldInsideLambda() {
// Checks that foo is not a generator