Skip to content

Commit

Permalink
Add more xrefs to carbon-language#2022 and to carbon-language#1084.
Browse files Browse the repository at this point in the history
  • Loading branch information
zygoloid committed Sep 20, 2022
1 parent db3de32 commit b12a666
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion proposals/p2188.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.
Expand Down

0 comments on commit b12a666

Please sign in to comment.