Skip to content

Commit

Permalink
Refine error recovery. TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
josh11b committed Jan 10, 2025
1 parent 4204c9e commit 7cd127d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions toolchain/check/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ auto AddConstantsToImplWitnessFromConstraint(Context& context,
if (auto decl =
context.insts().TryGetAs<SemIR::AssociatedConstantDecl>(decl_id)) {
auto& witness_value = witness_block[index];
if (witness_value == SemIR::ErrorInst::SingletonInstId) {
continue;
}
auto rewrite_value = rewrite_values[index];
if (witness_value.is_valid()) {
if (witness_value.is_valid() &&
witness_value != SemIR::ErrorInst::SingletonInstId) {
// TODO: Support just using the witness values if the redeclaration uses
// `where _`, per proposal #1084.
if (!rewrite_value.is_valid()) {
CARBON_DIAGNOSTIC(AssociatedConstantMissingInRedecl, Error,
"associated constant {0} given value in "
Expand All @@ -342,7 +342,8 @@ auto AddConstantsToImplWitnessFromConstraint(Context& context,
continue;
}
auto witness_const_id = context.constant_values().Get(witness_value);
if (witness_const_id != rewrite_value) {
if (witness_const_id != rewrite_value &&
rewrite_value != SemIR::ErrorInst::SingletonConstantId) {
// TODO: Figure out how to print the two different values
CARBON_DIAGNOSTIC(
AssociatedConstantDifferentInRedecl, Error,
Expand Down

0 comments on commit 7cd127d

Please sign in to comment.