Decouple associated constants from let (#5973)

Decouples associated constants from being special cased in let handlers.
Enforces associated constant grammar restrictions in parsing instead of
checking.

Closes #5411
This commit is contained in:
Elliott Kalt
2025-09-02 23:15:26 +00:00
committed by GitHub
parent 0e6dd7e701
commit 58de34e534
43 changed files with 755 additions and 677 deletions
-9
View File
@@ -74,15 +74,6 @@ auto HandleParseNode(Context& context, Parse::TuplePatternId node_id) -> bool {
context.node_stack()
.PopAndDiscardSoloNodeId<Parse::NodeKind::TuplePatternStart>();
if (context.scope_stack().GetCurrentScopeAs<SemIR::InterfaceDecl>()) {
CARBON_DIAGNOSTIC(ExpectedSingleBindingInAssociatedConstant, Error,
"found tuple pattern in associated constant declaration; "
"expected symbolic binding pattern");
context.emitter().Emit(node_id, ExpectedSingleBindingInAssociatedConstant);
context.node_stack().Push(node_id, SemIR::ErrorInst::InstId);
EndSubpatternAsNonExpr(context);
return true;
}
const auto& inst_block = context.inst_blocks().Get(refs_id);
llvm::SmallVector<SemIR::InstId> type_inst_ids;
type_inst_ids.reserve(inst_block.size());