mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 08:34:43 +01:00
Move parse tree tests to files. (#2437)
I think it'd be helpful to examine what the parse tree looks like in failure cases. Note, I'm not sure that the behavior of the recovery situations is correct; the test had been asserting that the parse tree should indicate it's error free. However, this means that the only signal the the driver that the input is invalid is that the diagnostic emitter was used. I think it may be important to have it return a non-zero error to prevent compile, or we can turn these into warnings but then "requiring a space" is wrong. Either way, that's a concern I have with the pre-existing recovery behavior: I'm just trying to highlight it as I make this change, because now the test is really that nodes aren't tagged with has_error.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// 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} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', has_error: yes, subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// TODO: We could figure out that this first Failed example is infix
|
||||
// with one-token lookahead.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_infix_uneven_space_after.carbon:[[@LINE+1]]:16: Expected `;` after expression.
|
||||
var n: i8 = n* n;
|
||||
+1
-1
@@ -21,6 +21,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_missing_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_precedence_and_or.carbon:[[@LINE+1]]:11: Parentheses are required to disambiguate operator precedence.
|
||||
a and b or c;
|
||||
}
|
||||
+1
-1
@@ -21,6 +21,6 @@
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_missing_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_precedence_or_and.carbon:[[@LINE+1]]:10: Parentheses are required to disambiguate operator precedence.
|
||||
a or b and c;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '-', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_precedence_star_minus.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
var n: i8 = n* -n;
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'p'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 10},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_precedence_star_star.carbon:[[@LINE+1]]:16: Parentheses are required to disambiguate operator precedence.
|
||||
var n: i8 = n* *p;
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// TODO: We try to form (n*)*p and reject due to missing parentheses
|
||||
// before we notice the missing whitespace around the second `*`.
|
||||
// It'd be better to (somehow) form n*(*p) and reject due to the missing
|
||||
// whitespace around the first `*`.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/fail_star_star_no_space.carbon:[[@LINE+1]]:16: Expected `;` after expression.
|
||||
var n: i8 = n**p;
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 = n * n;
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 = n*n;
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: '3'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpressionOrTupleLiteralStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpression', text: ')', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 = 3*(n);
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpressionOrTupleLiteralStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpression', text: ')', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: '3'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 = (n)*3;
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var v: Type = i8*;
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var v: Type = i8* ;
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PrefixOperator', text: '-', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 = -n;
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PrefixOperator', text: '-', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
var n: i8 =-n;
|
||||
// Valid
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'InfixOperator', text: '*', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_infix_uneven_space_before.carbon:[[@LINE+1]]:15: Whitespace missing after binary operator.
|
||||
var n: i8 = n *n;
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
|
||||
var v: Type = i8 *;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'CallExpressionStart', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'CallExpressionComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: '0'},
|
||||
// CHECK:STDOUT: {kind: 'CallExpression', text: ')', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 13},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_before_comma.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
|
||||
var n: i8 = F(i8 *, 0);
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'CallExpressionStart', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'CallExpression', text: ')', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 11},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_in_call.carbon:[[@LINE+1]]:18: Whitespace is not allowed before this unary operator.
|
||||
var n: i8 = F(i8 *);
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'v'},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'Type'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PostfixOperator', text: '*', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+2]]:18: Whitespace is not allowed before this unary operator.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_postfix_space_surrounding.carbon:[[@LINE+1]]:18: Whitespace is required after this unary operator.
|
||||
var v: Type = i8 * ;
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PrefixOperator', text: '-', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+2]]:13: Whitespace is not allowed after this unary operator.
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_prefix_space.carbon:[[@LINE+1]]:13: Whitespace is required before this unary operator.
|
||||
var n: i8 = - n;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// 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: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i8'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'n'},
|
||||
// CHECK:STDOUT: {kind: 'PrefixOperator', text: '-', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'VariableInitializer', text: '=', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDeclaration', text: ';', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/operators/recover_prefix_uneven_space_with_assign.carbon:[[@LINE+1]]:12: Whitespace is not allowed after this unary operator.
|
||||
var n: i8 =- n;
|
||||
Reference in New Issue
Block a user