fail_non_tuple_access.carbon 1.1 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. // AUTOUPDATE
  6. fn Main() {
  7. // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+3]]:3: ERROR: Type `i32` does not support indexing.
  8. // CHECK:STDERR: 0[1];
  9. // CHECK:STDERR: ^~~~
  10. 0[1];
  11. }
  12. // CHECK:STDOUT: --- fail_non_tuple_access.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: i32 = int_literal 0 [template]
  16. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  21. // CHECK:STDOUT: .Main = %Main
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT: %Main: <function> = fn_decl @Main [template] {}
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: fn @Main() {
  27. // CHECK:STDOUT: !entry:
  28. // CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 [template = constants.%.1]
  29. // CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 [template = constants.%.2]
  30. // CHECK:STDOUT: return
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: