fail_star_star_no_space.carbon 2.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_star_star_no_space.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_star_star_no_space.carbon
  10. // TODO: We try to form (n*)*p and reject due to missing parentheses
  11. // before we notice the missing whitespace around the second `*`.
  12. // It'd be better to (somehow) form n*(*p) and reject due to the missing
  13. // whitespace around the first `*`.
  14. // CHECK:STDERR: fail_star_star_no_space.carbon:[[@LINE+4]]:16: error: `var` declarations must end with a `;` [ExpectedDeclSemi]
  15. // CHECK:STDERR: var n: i8 = n**p;
  16. // CHECK:STDERR: ^
  17. // CHECK:STDERR:
  18. var n: i8 = n**p;
  19. // CHECK:STDOUT: - filename: fail_star_star_no_space.carbon
  20. // CHECK:STDOUT: parse_tree: [
  21. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  22. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  23. // CHECK:STDOUT: {kind: 'IdentifierNameNotBeforeParams', text: 'n'},
  24. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
  25. // CHECK:STDOUT: {kind: 'VarBindingPattern', text: ':', subtree_size: 3},
  26. // CHECK:STDOUT: {kind: 'VariablePattern', text: 'var', subtree_size: 4},
  27. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  28. // CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'n'},
  29. // CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2},
  30. // CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 3},
  31. // CHECK:STDOUT: {kind: 'VariableDecl', text: ';', has_error: yes, subtree_size: 10},
  32. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  33. // CHECK:STDOUT: ]