Files
carbon-lang/explorer/testdata/var/global/fail_nested_binding.carbon
T
Jon Ross-Perkins c9f0ef9e2c Require names where we expect binding patterns (#2782)
This also clusters the various `var` tests. This tests similar patterns for a few syntaxes, but `fn f(x: i32, i32) {}` and local variables `var (x: i32, i32);` and `var i32;` were the crashers I found.

In `fn`, the `x: i32,` is helpful to convince the parser that this is valid syntax.

Fixes #2778
2023-04-20 10:58:03 -07:00

20 lines
692 B
Plaintext

// 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
//
// AUTOUPDATE
// RUN: %{not} %{explorer-run}
// RUN: %{not} %{explorer-run-trace}
package ExplorerTest api;
// If support for this is added, it'll be necessary to verify that either the
// implementation is shared with locals or that tests are copied over for edge
// cases.
// CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/var/global/fail_nested_binding.carbon:[[@LINE+1]]: syntax error, unexpected LEFT_PARENTHESIS, expecting identifier
var (x: i32,);
fn Main() -> i32 {
return 0;
}