PyType (@NotNull final PyTypedElement element) { return RecursionManager.doPreventingRecursion( Pair.create(element, this), false, () -> { synchronized (myEvaluated) { if (myEvaluated.containsKey(element)) { final PyType type = myEvaluated.get(element); assertValid(type, element); return type; } } final PyType type = element.getType(this, Key.INSTANCE); assertValid(type, element); synchronized (myEvaluated) { myEvaluated.put(element, type); } return type; } ); }