mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
PY-84289 Compute getStringBasedType with doPreventingRecursion to avoid repeating calculations
(cherry picked from commit a548f05bea971f6b3e3acdb1f1bc7898d3411d5e) IJ-MR-176651 GitOrigin-RevId: 7fc85277f5dcd118095be9b84813a4180b2ae4b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4c6edd442e
commit
b9a11311b5
@@ -1337,8 +1337,10 @@ public final class PyTypingTypeProvider extends PyTypeProviderWithCustomContext<
|
||||
}
|
||||
|
||||
private static @Nullable Ref<PyType> getStringBasedType(@NotNull String contents, @NotNull PsiElement anchor, @NotNull Context context) {
|
||||
final PyExpression expr = toExpression(contents, anchor);
|
||||
return expr != null ? getType(expr, context) : null;
|
||||
return doPreventingRecursion(Pair.create(anchor, contents), true, () -> {
|
||||
final PyExpression expr = toExpression(contents, anchor);
|
||||
return expr != null ? getType(expr, context) : null;
|
||||
});
|
||||
}
|
||||
|
||||
private static @Nullable PyType getStringLiteralType(@NotNull PsiElement element, @NotNull Context context) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
config_response = {}
|
||||
@@ -0,0 +1,35 @@
|
||||
from a import config_response
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
|
||||
config_response = {}
|
||||
config_map = config_response["spec"]["config_map"]
|
||||
kafka_consumer_key = config_map["component.job.static.job2"]["spec.plugin.kafka.connectivity.in"]
|
||||
@@ -2902,6 +2902,19 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// PY-84289
|
||||
public void testExponentialAnalysisTimeWhenMapLookupKeyEqualsVariableName() {
|
||||
long before = System.currentTimeMillis();
|
||||
doMultiFileTest("main.py");
|
||||
long after = System.currentTimeMillis();
|
||||
long diff = after - before;
|
||||
// junit3 doesn't support timeouts out of the box
|
||||
if (diff > 5000) {
|
||||
fail("Took too long to analyze main.py: " + diff + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Class<? extends PyInspection> getInspectionClass() {
|
||||
|
||||
Reference in New Issue
Block a user