fail_flush_errors.carbon 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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. // ARGS: compile %s
  6. //
  7. // AUTOUPDATE
  8. fn F() {
  9. // Create diagnostics containing string references, and trigger reallocation
  10. // of the string table.
  11. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+4]]:3: ERROR: Name `undeclared1` not found.
  12. // CHECK:STDERR: undeclared1;
  13. // CHECK:STDERR: ^~~~~~~~~~~
  14. // CHECK:STDERR:
  15. undeclared1;
  16. // Add the name into the string table from the tokenized buffer's string
  17. // literal storage. Use a hex escape to ensure that the tokenized buffer
  18. // allocates separate storage for the result.
  19. "undec\x6Cared2";
  20. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+4]]:3: ERROR: Name `undeclared2` not found.
  21. // CHECK:STDERR: undeclared2;
  22. // CHECK:STDERR: ^~~~~~~~~~~
  23. // CHECK:STDERR:
  24. undeclared2;
  25. // Add the name into the string table via a declaration rather than an expression.
  26. if (true) { var undeclared3: i32 = 0; }
  27. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: ERROR: Name `undeclared3` not found.
  28. // CHECK:STDERR: undeclared3;
  29. // CHECK:STDERR: ^~~~~~~~~~~
  30. undeclared3;
  31. }