fail_no_parens.carbon 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/generics/deduced_params/fail_no_parens.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon
  10. // CHECK:STDERR: fail_no_parens.carbon:[[@LINE+4]]:12: ERROR: A `(` for parameters is required after implicit parameters.
  11. // CHECK:STDERR: class Foo[];
  12. // CHECK:STDERR: ^
  13. // CHECK:STDERR:
  14. class Foo[];
  15. // CHECK:STDERR: fail_no_parens.carbon:[[@LINE+4]]:18: ERROR: A `(` for parameters is required after implicit parameters.
  16. // CHECK:STDERR: class Foo[a: i32];
  17. // CHECK:STDERR: ^
  18. // CHECK:STDERR:
  19. class Foo[a: i32];
  20. // CHECK:STDERR: fail_no_parens.carbon:[[@LINE+4]]:17: ERROR: A `(` for parameters is required after implicit parameters.
  21. // CHECK:STDERR: interface Bar[] {}
  22. // CHECK:STDERR: ^
  23. // CHECK:STDERR:
  24. interface Bar[] {}
  25. // CHECK:STDERR: fail_no_parens.carbon:[[@LINE+3]]:23: ERROR: A `(` for parameters is required after implicit parameters.
  26. // CHECK:STDERR: interface Bar[a: i32] {}
  27. // CHECK:STDERR: ^
  28. interface Bar[a: i32] {}
  29. // CHECK:STDOUT: - filename: fail_no_parens.carbon
  30. // CHECK:STDOUT: parse_tree: [
  31. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  32. // CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
  33. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'Foo'},
  34. // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
  35. // CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 2},
  36. // CHECK:STDOUT: {kind: 'ClassDecl', text: ';', has_error: yes, subtree_size: 5},
  37. // CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
  38. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'Foo'},
  39. // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
  40. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
  41. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  42. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
  43. // CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
  44. // CHECK:STDOUT: {kind: 'ClassDecl', text: ';', has_error: yes, subtree_size: 8},
  45. // CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
  46. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'Bar'},
  47. // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
  48. // CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 2},
  49. // CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 5},
  50. // CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
  51. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'Bar'},
  52. // CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
  53. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'a'},
  54. // CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
  55. // CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
  56. // CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
  57. // CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 8},
  58. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  59. // CHECK:STDOUT: ]