PY-20057 Unify type vars constrained by class types and instance types

so that annotations like "def f(x: Type[T]) -> T" (and vice-versa) work
as expected.

Additionally, I've added a new method toClass() in PyInstantiableType
interface that is supposed to be the opposite to existing toInstance().
This commit is contained in:
Mikhail Golubev
2017-02-14 17:53:40 +03:00
parent 46c229030e
commit b6dbc5b989
9 changed files with 82 additions and 4 deletions

View File

@@ -128,11 +128,18 @@ public class PyJavaClassType implements PyClassLikeType {
return myDefinition;
}
@NotNull
@Override
public PyClassLikeType toInstance() {
return myDefinition ? new PyJavaClassType(myClass, false) : this;
}
@NotNull
@Override
public PyClassLikeType toClass() {
return myDefinition ? this : new PyJavaClassType(myClass, true);
}
@Nullable
@Override
public String getClassQName() {