public Set<InferenceVariable> getDependencies(InferenceSession session) {
    final Set<InferenceVariable> dependencies = new LinkedHashSet<>();
    collectBoundDependencies(session, dependencies);
    collectTransitiveDependencies(session, dependencies, dependencies);
    
    if (!session.hasCapture(this) && dependencies.isEmpty()) {
      return dependencies;
    }

    if (!session.hasCapture(this)) {
      return dependencies;
    }

    dependencies.removeIf(variable -> !session.hasCapture(variable));
    session.collectCaptureDependencies(this, dependencies);
    return dependencies;
  }
public Set<InferenceVariable> getDependencies(InferenceSession session)