fail_after_decl.carbon 1.3 KB

12345678910111213141516171819202122232425262728
  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. fn A();
  7. // CHECK:STDERR: fail_after_decl.carbon:[[@LINE+6]]:1: ERROR: `import` directives must come after the `package` directive (if present) and before any other entities in the file.
  8. // CHECK:STDERR: import B;
  9. // CHECK:STDERR: ^~~~~~
  10. // CHECK:STDERR: fail_after_decl.carbon:[[@LINE-5]]:1: First declaration is here.
  11. // CHECK:STDERR: fn A();
  12. // CHECK:STDERR: ^~
  13. import B;
  14. // CHECK:STDOUT: - filename: fail_after_decl.carbon
  15. // CHECK:STDOUT: parse_tree: [
  16. // CHECK:STDOUT: {kind: 'FileStart', text: ''},
  17. // CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
  18. // CHECK:STDOUT: {kind: 'IdentifierName', text: 'A'},
  19. // CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
  20. // CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
  21. // CHECK:STDOUT: {kind: 'FunctionDecl', text: ';', subtree_size: 5},
  22. // CHECK:STDOUT: {kind: 'ImportIntroducer', text: 'import'},
  23. // CHECK:STDOUT: {kind: 'ImportDirective', text: ';', has_error: yes, subtree_size: 2},
  24. // CHECK:STDOUT: {kind: 'FileEnd', text: ''},
  25. // CHECK:STDOUT: ]