mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-27128 PY-48466 Fix problem with imports in PyMakeFunctionReturnTypeQuickFix
(cherry picked from commit 9320c2e708afa2ddd025f60b0c122132387493b7) IJ-MR-10124 GitOrigin-RevId: 219e646482999e8b81b77aaf52eb24574381af3d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fe812b5f46
commit
903f6e11ca
+8
@@ -0,0 +1,8 @@
|
||||
import my
|
||||
|
||||
|
||||
def foo(a) -> my.X:
|
||||
if a:
|
||||
return <warning descr="Expected type 'X', got 'Type[X]' instead">my.X<caret></warning>
|
||||
else:
|
||||
return <warning descr="Expected type 'X', got 'Type[Y]' instead">my.Y</warning>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
from typing import Type
|
||||
|
||||
import my
|
||||
from my import X
|
||||
|
||||
|
||||
def foo(a) -> Type[X]:
|
||||
if a:
|
||||
return my.X<caret>
|
||||
else:
|
||||
return my.Y
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class X():
|
||||
pass
|
||||
|
||||
class Y(X):
|
||||
pass
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import my
|
||||
|
||||
|
||||
def foo(a) -> my.X:
|
||||
if a:
|
||||
return <warning descr="Expected type 'X', got 'Type[X]' instead">my.X<caret></warning>
|
||||
else:
|
||||
return <warning descr="Expected type 'X', got 'Type[Y]' instead">my.Y</warning>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
from typing import Type
|
||||
|
||||
import my
|
||||
from my import X, Y
|
||||
|
||||
|
||||
def foo(a) -> Type[X | Y]:
|
||||
if a:
|
||||
return my.X
|
||||
else:
|
||||
return my.Y
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class X():
|
||||
pass
|
||||
|
||||
class Y():
|
||||
pass
|
||||
@@ -0,0 +1,2 @@
|
||||
def func() -> int:
|
||||
return <warning descr="Expected type 'int', got '(x: Any) -> int' instead">lambda x: 42<caret></warning>
|
||||
@@ -0,0 +1,5 @@
|
||||
from typing import Callable, Any
|
||||
|
||||
|
||||
def func() -> Callable[[Any], int]:
|
||||
return lambda x: 42<caret>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import my
|
||||
|
||||
|
||||
def foo(a) -> my.X:
|
||||
if a:
|
||||
return <warning descr="Expected type 'X', got 'Type[X]' instead">my.X<caret></warning>
|
||||
else:
|
||||
return <warning descr="Expected type 'X', got 'Type[Y]' instead">my.Y</warning>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Type
|
||||
|
||||
import my
|
||||
from my import X, Y
|
||||
|
||||
|
||||
def foo(a) -> Type[X | Y]:
|
||||
if a:
|
||||
return my.X
|
||||
else:
|
||||
return my.Y
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class X():
|
||||
pass
|
||||
|
||||
class Y():
|
||||
pass
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import my
|
||||
|
||||
|
||||
def foo(a) -> my.X:
|
||||
if a:
|
||||
return <warning descr="Expected type 'X', got 'Type[X]' instead">my.X<caret></warning>
|
||||
else:
|
||||
return <warning descr="Expected type 'X', got 'Type[Y]' instead">my.Y</warning>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
from typing import Union, Type
|
||||
|
||||
import my
|
||||
from my import X, Y
|
||||
|
||||
|
||||
def foo(a) -> Type[Union[X, Y]]:
|
||||
if a:
|
||||
return my.X
|
||||
else:
|
||||
return my.Y
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class X():
|
||||
pass
|
||||
|
||||
class Y():
|
||||
pass
|
||||
Reference in New Issue
Block a user