mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-59241 Replace instantiations of PyGenericType with PyTypeVarTypeImpl
The rest of the usages will be updated later on not to cause excess conflicts with a few big features currently being developed. Also removed a redundant constructor that can be replicated with toInstance/toClass methods. GitOrigin-RevId: d9af65d8ac865b1eb822607987f8195809f3ec23
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d638124b28
commit
c25b2fec9c
+1
-1
@@ -1549,7 +1549,7 @@ public class PyTypingTypeProvider extends PyTypeProviderWithCustomContext<PyTypi
|
||||
final PyExpression firstArgument = arguments[0];
|
||||
if (firstArgument instanceof PyStringLiteralExpression) {
|
||||
final String name = ((PyStringLiteralExpression)firstArgument).getStringValue();
|
||||
return new PyGenericType(name, getGenericTypeBound(arguments, context));
|
||||
return new PyTypeVarTypeImpl(name, getGenericTypeBound(arguments, context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,11 +179,11 @@ public final class PyTypeParser {
|
||||
final TextRange range = token.getRange();
|
||||
final ParseResult boundResult = value.getSecond();
|
||||
if (boundResult != null) {
|
||||
final PyGenericType type1 = new PyGenericType(name, boundResult.getType());
|
||||
final PyGenericType type1 = new PyTypeVarTypeImpl(name, boundResult.getType());
|
||||
final ParseResult result = new ParseResult(type1, range);
|
||||
return result.merge(boundResult).withType(type1);
|
||||
}
|
||||
return new ParseResult(new PyGenericType(name, null), range);
|
||||
return new ParseResult(new PyTypeVarTypeImpl(name, null), range);
|
||||
})
|
||||
.named("type-parameter");
|
||||
|
||||
|
||||
@@ -7,8 +7,4 @@ public final class PyTypeVarTypeImpl extends PyGenericType {
|
||||
public PyTypeVarTypeImpl(@NotNull String name, @Nullable PyType bound) {
|
||||
super(name, bound);
|
||||
}
|
||||
|
||||
public PyTypeVarTypeImpl(@NotNull String name, @Nullable PyType bound, boolean isDefinition) {
|
||||
super(name, bound, isDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1604,8 +1604,8 @@ public class Py3TypeTest extends PyTestCase {
|
||||
|
||||
// PY-54336
|
||||
public void testCyclePreventionDuringGenericsSubstitution() {
|
||||
PyGenericType typeVarT = new PyGenericType("T", null, false);
|
||||
PyGenericType typeVarV = new PyGenericType("V", null, false);
|
||||
PyGenericType typeVarT = new PyTypeVarTypeImpl("T", null);
|
||||
PyGenericType typeVarV = new PyTypeVarTypeImpl("V", null);
|
||||
TypeEvalContext context = TypeEvalContext.codeInsightFallback(myFixture.getProject());
|
||||
PyType substituted;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user