Add support for _ placeholder. (#661)

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
Geoff Romer
2021-07-19 10:33:06 -07:00
committed by GitHub
co-authored by Jon Meow
parent c3c89a77a4
commit def98d1182
15 changed files with 88 additions and 20 deletions
+11
View File
@@ -0,0 +1,11 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
fn ReturnSecond(_: Int, x: Int) -> Int {
return x;
}
fn main() -> Int {
return ReturnSecond(1, 0);
}
@@ -0,0 +1 @@
result: 0
+11
View File
@@ -0,0 +1,11 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
fn main() -> Int {
var t: auto = (1, 2, 3, 4);
match (t) {
case (_: Int, _: auto, x: Int, y: auto) =>
return y - x - 1;
}
}
@@ -0,0 +1 @@
result: 0
@@ -0,0 +1,8 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
fn main() -> Int {
var _: auto = 1;
return 0;
}
@@ -0,0 +1 @@
result: 0