mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:21:04 +01:00
Support complex type patterns in bindings. (#759)
Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
co-authored by
Jon Meow
parent
2295658697
commit
7138ee400f
+1
-3
@@ -1,4 +1,2 @@
|
||||
COMPILATION ERROR: 8: type error in pattern variable
|
||||
expected: (x = i32, y = i32)
|
||||
actual: (y = i32, x = i32)
|
||||
PROGRAM ERROR: 8: Tuple field name 'y' does not match pattern field name 'x'
|
||||
EXIT CODE: 255
|
||||
|
||||
@@ -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() -> i32 {
|
||||
var t: (auto, (i32, i32)) = ((1,2),(3,4));
|
||||
return t[0][0] + t[1][1] - 5;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
result: 0
|
||||
Reference in New Issue
Block a user