mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 14:20:23 +01:00
* Change `InterfaceWitness` -> `ImplWitness` * Include a `SpecificId` in the `ImplWitness`. This allows the `InstBlock` it contains to have its own identity, allowing it to be changed as the impl is processed. Evaluation only updates the specific. * Create the `ImplWitness` at the start of the impl definition. In the future, this will be populated with the values of non-function associated constants. For now, it starts full of invalid instruction ids. * Implements the model suggested in #4672 . Note that the non-SemIR testdata changes are to these file: * `toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon` * `toolchain/check/testdata/struct/import.carbon` * `toolchain/check/testdata/tuple/import.carbon` The last two are due to an import of generics bug exposed by this PR, which will be fixed in a follow-on. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>
31 lines
1.1 KiB
C++
31 lines
1.1 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_CHECK_IMPL_H_
|
|
#define CARBON_TOOLCHAIN_CHECK_IMPL_H_
|
|
|
|
#include "toolchain/check/context.h"
|
|
#include "toolchain/sem_ir/ids.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
// Returns the initial witness value for a new impl declaration.
|
|
auto ImplWitnessForDeclaration(Context& context, const SemIR::Impl& impl)
|
|
-> SemIR::InstId;
|
|
|
|
// TODO: AddConstantsToImplWitnessFromConstraint()
|
|
|
|
// Update `impl`'s witness at the start of a definition.
|
|
auto ImplWitnessStartDefinition(Context& context, SemIR::Impl& impl) -> void;
|
|
|
|
// Adds the function members to the witness for `impl`.
|
|
auto FinishImplWitness(Context& context, SemIR::Impl& impl) -> void;
|
|
|
|
// Sets all unset members of the witness for `impl` to the error instruction.
|
|
auto FillImplWitnessWithErrors(Context& context, SemIR::Impl& impl) -> void;
|
|
|
|
} // namespace Carbon::Check
|
|
|
|
#endif // CARBON_TOOLCHAIN_CHECK_IMPL_H_
|