fail_flush_errors.carbon 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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+3]]:3: Name `undeclared1` not found.
  12. // CHECK:STDERR: undeclared1;
  13. // CHECK:STDERR: ^
  14. undeclared1;
  15. // Add the name into the string table from the tokenized buffer's string
  16. // literal storage. Use a hex escape to ensure that the tokenized buffer
  17. // allocates separate storage for the result.
  18. "undec\x6Cared2";
  19. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: Name `undeclared2` not found.
  20. // CHECK:STDERR: undeclared2;
  21. // CHECK:STDERR: ^
  22. undeclared2;
  23. // Add the name into the string table via a declaration rather than an expression.
  24. if (true) { var undeclared3: i32 = 0; }
  25. // CHECK:STDERR: fail_flush_errors.carbon:[[@LINE+3]]:3: Name `undeclared3` not found.
  26. // CHECK:STDERR: undeclared3;
  27. // CHECK:STDERR: ^
  28. undeclared3;
  29. }