// 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/auto/match_case.carbon // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/auto/match_case.carbon fn f() -> bool { match (true) { case x: auto if (x == true) => { return true; } default => { return false; } } } // CHECK:STDOUT: - filename: match_case.carbon // CHECK:STDOUT: ╭─FileStart '' // CHECK:STDOUT: │ ╭─FunctionIntroducer 'fn' // CHECK:STDOUT: │ ├─IdentifierNameMaybeBeforeSignature 'f' // CHECK:STDOUT: │ │ ╭─ExplicitParamListStart '(' // CHECK:STDOUT: │ ├─ExplicitParamList ')' // CHECK:STDOUT: │ │ ╭─BoolTypeLiteral 'bool' // CHECK:STDOUT: │ ├─ReturnType '->' // CHECK:STDOUT: │ ╭─FunctionDefinitionStart '{' // CHECK:STDOUT: │ │ ╭─MatchIntroducer 'match' // CHECK:STDOUT: │ │ │ ╭─MatchConditionStart '(' // CHECK:STDOUT: │ │ │ ├─BoolLiteralTrue 'true' // CHECK:STDOUT: │ │ ├─MatchCondition ')' // CHECK:STDOUT: │ │ ╭─MatchStatementStart '{' // CHECK:STDOUT: │ │ │ ╭─MatchCaseIntroducer 'case' // CHECK:STDOUT: │ │ │ │ ╭─IdentifierNameNotBeforeSignature 'x' // CHECK:STDOUT: │ │ │ │ ├─BindingPatternTypeStart ':' // CHECK:STDOUT: │ │ │ │ ├─AutoTypeLiteral 'auto' // CHECK:STDOUT: │ │ │ ├─LetBindingPattern ':' // CHECK:STDOUT: │ │ │ │ ╭─MatchCaseGuardIntroducer 'if' // CHECK:STDOUT: │ │ │ │ ├─MatchCaseGuardStart '(' // CHECK:STDOUT: │ │ │ │ │ ╭─IdentifierNameExpr 'x' // CHECK:STDOUT: │ │ │ │ │ ├─BoolLiteralTrue 'true' // CHECK:STDOUT: │ │ │ │ ├─InfixOperatorEqualEqual '==' // CHECK:STDOUT: │ │ │ ├─MatchCaseGuard ')' // CHECK:STDOUT: │ │ │ ╭─MatchCase '=>' // CHECK:STDOUT: │ │ │ ╭─MatchHandlerStart '{' // CHECK:STDOUT: │ │ │ │ ╭─ReturnStatementStart 'return' // CHECK:STDOUT: │ │ │ │ ├─BoolLiteralTrue 'true' // CHECK:STDOUT: │ │ │ ├─ReturnStatement ';' // CHECK:STDOUT: │ │ ├─MatchHandler '}' // CHECK:STDOUT: │ │ │ ╭─MatchDefaultIntroducer 'default' // CHECK:STDOUT: │ │ │ ╭─MatchDefault '=>' // CHECK:STDOUT: │ │ │ ╭─MatchHandlerStart '{' // CHECK:STDOUT: │ │ │ │ ╭─ReturnStatementStart 'return' // CHECK:STDOUT: │ │ │ │ ├─BoolLiteralFalse 'false' // CHECK:STDOUT: │ │ │ ├─ReturnStatement ';' // CHECK:STDOUT: │ │ ├─MatchHandler '}' // CHECK:STDOUT: │ ├─MatchStatement '}' // CHECK:STDOUT: ├─FunctionDefinition '}' // CHECK:STDOUT: ├─FileEnd '' // CHECK:STDOUT: (root)