diff --git a/proposals/p2188.md b/proposals/p2188.md index ccb7d5314991b..cd25e6fe1b4c3 100644 --- a/proposals/p2188.md +++ b/proposals/p2188.md @@ -172,7 +172,10 @@ ignore part of a value. - _binding-pattern_ ::= `_` `:` _expression_ -The behavior is equivalent to that of an `unused` binding with a unique name. +See [#2022](https://github.com/carbon-language/carbon-lang/pull/2022) for +details. + +The behavior is similar to that of an `unused` binding with a unique name. ``` fn F(n: i32) { @@ -185,6 +188,22 @@ fn F(n: i32) { } ``` +As specified in [#1084](p1084.md), function redeclarations may replace named +bindings with wildcards but may not use different names. + +``` +fn G(n: i32); +fn H(n: i32); +fn J(n: i32); + +// ✅ Does not use `n`. +fn G(_: i32) {} +// ❌ Error: name of parameter does not match declaration. +fn H(m: i32) {} +// ✅ Does not use `n`. +fn J(unused n: i32); +``` + #### Generic bindings A `:!` can be used in place of `:` for a binding that is usable at compile time.