interface.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TOOLCHAIN_CHECK_INTERFACE_H_
  5. #define CARBON_TOOLCHAIN_CHECK_INTERFACE_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::Check {
  9. // Builds and returns an associated entity for `interface_id` corresponding to
  10. // the declaration `decl_id`, which can be an associated function or an
  11. // associated constant. Registers the associated entity in the list for the
  12. // interface.
  13. auto BuildAssociatedEntity(Context& context, SemIR::InterfaceId interface_id,
  14. SemIR::InstId decl_id) -> SemIR::InstId;
  15. // Gets the self specific of a generic declaration that is an interface member,
  16. // given a specific for the interface plus a type to use as `Self`.
  17. auto GetSelfSpecificForInterfaceMemberWithSelfType(
  18. Context& context, SemIRLoc loc, SemIR::SpecificId interface_specific_id,
  19. SemIR::GenericId generic_id, SemIR::TypeId self_type_id,
  20. SemIR::InstId witness_inst_id) -> SemIR::SpecificId;
  21. // Gets the type of the specified associated entity, given the specific for the
  22. // interface and the type of `Self`.
  23. auto GetTypeForSpecificAssociatedEntity(Context& context, SemIRLoc loc,
  24. SemIR::SpecificId interface_specific_id,
  25. SemIR::InstId decl_id,
  26. SemIR::TypeId self_type_id,
  27. SemIR::InstId self_witness_id)
  28. -> SemIR::TypeId;
  29. } // namespace Carbon::Check
  30. #endif // CARBON_TOOLCHAIN_CHECK_INTERFACE_H_