mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-16412 Import Type for annotations containing types of class objects
This commit is contained in:
committed by
Andrey Vlasovskikh
parent
7c5c6d1a7e
commit
034f409a6a
@@ -304,6 +304,9 @@ public class PyTypeHintGenerationUtil {
|
||||
collectImportTargetsFromType(pyType, classes, names);
|
||||
}
|
||||
}
|
||||
if (type instanceof PyInstantiableType && ((PyInstantiableType)type).isDefinition()) {
|
||||
names.add("Type");
|
||||
}
|
||||
}
|
||||
|
||||
public static final class AnnotationInfo {
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
|
||||
va<caret>r = Foo
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
from typing import Type
|
||||
|
||||
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
|
||||
var: [Type[Foo]] = Foo
|
||||
+4
@@ -199,6 +199,10 @@ public class PyAnnotateVariableTypeIntentionTest extends PyIntentionTestCase {
|
||||
doAnnotationTest();
|
||||
}
|
||||
|
||||
public void testAnnotationClassObjectType() {
|
||||
doAnnotationTest();
|
||||
}
|
||||
|
||||
private void doAnnotationTest() {
|
||||
doTest(LanguageLevel.PYTHON36);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user