def resolve(type_name, context))
  if type_name.absolute?
    return type_name
  end
  query = Query.new(type_name: type_name, context: context)
  try_cache(query) do
    path_head, *path_tail = type_name.to_namespace.path
    raise unless path_head
    name_head = TypeName.new(name: path_head, namespace: Namespace.empty)
    absolute_head = context.find do |namespace|
      
      full_name = name_head.with_prefix(namespace)
      has_name?(full_name) and break full_name
    end
    case absolute_head
    when TypeName
      has_name?(Namespace.new(path: absolute_head.to_namespace.path.push(*path_tail), absolute: true).to_type_name)
    when Namespace
      
      raise
    end
  end
end