mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 14:31:03 +01:00
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`.
66 lines
3.8 KiB
Plaintext
66 lines
3.8 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_variety.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_variety.carbon
|
|
|
|
fn F() {
|
|
// CHECK:STDERR: fail_variety.carbon:[[@LINE+20]]:21: error: operator `=` can only be used as a complete statement [StatementOperatorAsSubExpr]
|
|
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: fail_variety.carbon:[[@LINE+16]]:29: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses]
|
|
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
|
// CHECK:STDERR: ^~
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: fail_variety.carbon:[[@LINE+12]]:34: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses]
|
|
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: fail_variety.carbon:[[@LINE+8]]:38: error: parentheses are required to disambiguate operator precedence [OperatorRequiresParentheses]
|
|
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
|
// CHECK:STDERR: ^
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: fail_variety.carbon:[[@LINE+4]]:40: error: parentheses are required around this unary `not` operator [UnaryOperatorRequiresParentheses]
|
|
// CHECK:STDERR: n = a * b + c * d = d * d << e & f - not g;
|
|
// CHECK:STDERR: ^~~
|
|
// CHECK:STDERR:
|
|
n = a * b + c * d = d * d << e & f - not g;
|
|
}
|
|
|
|
// CHECK:STDOUT: - filename: fail_variety.carbon
|
|
// CHECK:STDOUT: ╭─FileStart ''
|
|
// CHECK:STDOUT: │ ╭─FunctionIntroducer 'fn'
|
|
// CHECK:STDOUT: │ ├─IdentifierNameMaybeBeforeSignature 'F'
|
|
// CHECK:STDOUT: │ │ ╭─ExplicitParamListStart '('
|
|
// CHECK:STDOUT: │ ├─ExplicitParamList ')'
|
|
// CHECK:STDOUT: │ ╭─FunctionDefinitionStart '{'
|
|
// CHECK:STDOUT: │ │ ╭─IdentifierNameExpr 'n'
|
|
// CHECK:STDOUT: │ │ │ ╭─IdentifierNameExpr 'a'
|
|
// CHECK:STDOUT: │ │ │ ├─IdentifierNameExpr 'b'
|
|
// CHECK:STDOUT: │ │ │ ╭─InfixOperatorStar '*'
|
|
// CHECK:STDOUT: │ │ │ │ ╭─IdentifierNameExpr 'c'
|
|
// CHECK:STDOUT: │ │ │ │ ├─IdentifierNameExpr 'd'
|
|
// CHECK:STDOUT: │ │ │ ├─InfixOperatorStar '*'
|
|
// CHECK:STDOUT: │ │ ├─InfixOperatorPlus '+'
|
|
// CHECK:STDOUT: │ │ ╭─InfixOperatorEqual '='
|
|
// CHECK:STDOUT: │ │ │ ╭─IdentifierNameExpr 'd'
|
|
// CHECK:STDOUT: │ │ │ ├─IdentifierNameExpr 'd'
|
|
// CHECK:STDOUT: │ │ │ ╭─InfixOperatorStar '*'
|
|
// CHECK:STDOUT: │ │ │ ├─IdentifierNameExpr 'e'
|
|
// CHECK:STDOUT: │ │ │ ╭─InfixOperatorLessLess '<<' has_error
|
|
// CHECK:STDOUT: │ │ │ ├─IdentifierNameExpr 'f'
|
|
// CHECK:STDOUT: │ │ │ ╭─InfixOperatorAmp '&' has_error
|
|
// CHECK:STDOUT: │ │ │ │ ╭─IdentifierNameExpr 'g'
|
|
// CHECK:STDOUT: │ │ │ ├─PrefixOperatorNot 'not'
|
|
// CHECK:STDOUT: │ │ ├─InfixOperatorMinus '-' has_error
|
|
// CHECK:STDOUT: │ │ ╭─InfixOperatorEqual '=' has_error
|
|
// CHECK:STDOUT: │ ├─ExprStatement ';'
|
|
// CHECK:STDOUT: ├─FunctionDefinition '}'
|
|
// CHECK:STDOUT: ├─FileEnd ''
|
|
// CHECK:STDOUT: (root)
|