Reconcile function default values between decl and def (#7665)

Updates the pattern matching code to support unspecified default values.
Adds logic to decl and def merge code to diagnose mismatches in defaults
if specified in both places, or if let entirely unspecified.

Per https://github.com/carbon-language/carbon-lang/pull/7521.
This commit is contained in:
Lucile Rose Nihlen
2026-09-08 20:41:58 +00:00
committed by GitHub
parent 5a07a14fe9
commit ca9e985fa8
30 changed files with 4624 additions and 3875 deletions
+1 -3
View File
@@ -141,8 +141,7 @@ class FullPatternStack {
// Marks the end of checking and pattern matching for the current
// full-pattern.
auto PopFullPattern() -> void {
auto kind = kind_stack_.back();
kind_stack_.pop_back();
auto kind = kind_stack_.pop_back_val();
bind_name_stack_.PopArray();
int index = next_var_index_stack_.pop_back_val();
CARBON_CHECK(index < 0 || static_cast<size_t>(index) ==
@@ -222,7 +221,6 @@ class FullPatternStack {
// the stack. Note default values are only supported for explicit parameter
// lists.
auto GetDefaultValues() -> llvm::ArrayRef<SemIR::InstId> {
CARBON_CHECK(!default_values_stack_.empty());
return default_values_stack_.PeekArray();
}