mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 19:20:10 +01:00
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
20 lines
692 B
Plaintext
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;
|
|
}
|