mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't narrow type variable to its bound if actual type is Any (PY-43027)
GitOrigin-RevId: 7fca22b43203fdfc9fa2e2fa7452e362e6ec8dfd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c5a8c9a330
commit
28dfeb83f5
@@ -215,7 +215,7 @@ public class PyTypeChecker {
|
||||
context.substitutions.put(expected, actual);
|
||||
}
|
||||
else if (bound != null) {
|
||||
context.substitutions.put(expected, bound);
|
||||
context.substitutions.put(expected, PyUnionType.createWeakType(bound));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -636,7 +636,7 @@ public class PyTypeTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testUpperBoundGeneric() {
|
||||
doTest("Union[int, str]",
|
||||
doTest("Union[Union[int, str], Any]",
|
||||
"def foo(x):\n" +
|
||||
" '''\n" +
|
||||
" :type x: T <= int or str\n" +
|
||||
|
||||
@@ -239,7 +239,7 @@ public class PyTypingTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testAnyStrForUnknown() {
|
||||
doTest("Union[str, bytes]",
|
||||
doTest("Union[Union[str, bytes], Any]",
|
||||
"from typing import AnyStr\n" +
|
||||
"\n" +
|
||||
"def foo(x: AnyStr) -> AnyStr:\n" +
|
||||
|
||||
Reference in New Issue
Block a user