Files
carbon-lang/toolchain/parse/testdata/operators/fail_invalid_infix.carbon
T
Geoff Romer 6429c1655c Make the tree structure more explicit in parse dumps (#7591)
It's hard to track 2-space indent levels across large vertical gaps, and
it can be hard to suppress the instinct to read the dump as if it were
preorder. This change introduces a new dump mode that addresses both
problems by using box-drawing characters to explicitly represent the
parent-child edges of the tree. This new mode is the default, but the
old behavior remains available with
`--parse-dump-format=yaml-postorder`.
2026-07-31 16:44:18 +00:00

68 lines
3.3 KiB
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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_invalid_infix.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_invalid_infix.carbon
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+4]]:19: error: expected expression [ExpectedExpr]
// CHECK:STDERR: var a: i32 = n == ;
// CHECK:STDERR: ^
// CHECK:STDERR:
var a: i32 = n == ;
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+4]]:14: error: expected expression [ExpectedExpr]
// CHECK:STDERR: var b: i32 = == n;
// CHECK:STDERR: ^~
// CHECK:STDERR:
var b: i32 = == n;
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+8]]:14: error: expected expression [ExpectedExpr]
// CHECK:STDERR: var c: i32 = == ;
// CHECK:STDERR: ^~
// CHECK:STDERR:
// CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+4]]:17: error: expected expression [ExpectedExpr]
// CHECK:STDERR: var c: i32 = == ;
// CHECK:STDERR: ^
// CHECK:STDERR:
var c: i32 = == ;
// CHECK:STDOUT: - filename: fail_invalid_infix.carbon
// CHECK:STDOUT: ╭─FileStart ''
// CHECK:STDOUT: │ ╭─VariableIntroducer 'var'
// CHECK:STDOUT: │ │ ╭─IdentifierNameNotBeforeSignature 'a'
// CHECK:STDOUT: │ │ ├─BindingPatternTypeStart ':'
// CHECK:STDOUT: │ │ ├─IntTypeLiteral 'i32'
// CHECK:STDOUT: │ │ ╭─VarBindingPattern ':'
// CHECK:STDOUT: │ ├─VariablePattern 'var'
// CHECK:STDOUT: │ ├─VariableInitializer '='
// CHECK:STDOUT: │ │ ╭─IdentifierNameExpr 'n'
// CHECK:STDOUT: │ │ ├─InvalidParse ';' has_error
// CHECK:STDOUT: │ ├─InfixOperatorEqualEqual '==' has_error
// CHECK:STDOUT: ├─VariableDecl ';'
// CHECK:STDOUT: │ ╭─VariableIntroducer 'var'
// CHECK:STDOUT: │ │ ╭─IdentifierNameNotBeforeSignature 'b'
// CHECK:STDOUT: │ │ ├─BindingPatternTypeStart ':'
// CHECK:STDOUT: │ │ ├─IntTypeLiteral 'i32'
// CHECK:STDOUT: │ │ ╭─VarBindingPattern ':'
// CHECK:STDOUT: │ ├─VariablePattern 'var'
// CHECK:STDOUT: │ ├─VariableInitializer '='
// CHECK:STDOUT: │ │ ╭─InvalidParse '==' has_error
// CHECK:STDOUT: │ │ ├─IdentifierNameExpr 'n'
// CHECK:STDOUT: │ ├─InfixOperatorEqualEqual '==' has_error
// CHECK:STDOUT: ├─VariableDecl ';'
// CHECK:STDOUT: │ ╭─VariableIntroducer 'var'
// CHECK:STDOUT: │ │ ╭─IdentifierNameNotBeforeSignature 'c'
// CHECK:STDOUT: │ │ ├─BindingPatternTypeStart ':'
// CHECK:STDOUT: │ │ ├─IntTypeLiteral 'i32'
// CHECK:STDOUT: │ │ ╭─VarBindingPattern ':'
// CHECK:STDOUT: │ ├─VariablePattern 'var'
// CHECK:STDOUT: │ ├─VariableInitializer '='
// CHECK:STDOUT: │ │ ╭─InvalidParse '==' has_error
// CHECK:STDOUT: │ │ ├─InvalidParse ';' has_error
// CHECK:STDOUT: │ ├─InfixOperatorEqualEqual '==' has_error
// CHECK:STDOUT: ├─VariableDecl ';'
// CHECK:STDOUT: ├─FileEnd ''
// CHECK:STDOUT: (root)