fail_star_star_no_space.carbon 1.8 KB

123456789101112131415161718192021222324252627282930313233
  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+3]]:16: ERROR: `var` declarations must end with a `;`.
  15. // CHECK:STDERR: var n: i8 = n**p;
  16. // CHECK:STDERR: ^
  17. var n: i8 = n**p;
  18. // CHECK:STDOUT: - filename: fail_star_star_no_space.carbon
  19. // CHECK:STDOUT: parse_tree: [
  20. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  21. // CHECK:STDOUT: {kind: 'VariableIntroducer', text: 'var'},
  22. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'n'},
  23. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i8'},
  24. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
  25. // CHECK:STDOUT: {kind: 'VariableInitializer', text: '='},
  26. // CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'n'},
  27. // CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 2},
  28. // CHECK:STDOUT: {kind: 'PostfixOperatorStar', text: '*', subtree_size: 3},
  29. // CHECK:STDOUT: {kind: 'VariableDecl', text: ';', has_error: yes, subtree_size: 9},
  30. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  31. // CHECK:STDOUT: ]