fail_non_tuple_access.carbon 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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: %Main: type = fn_type @Main [template]
  16. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  17. // CHECK:STDOUT: %struct: Main = struct_value () [template]
  18. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  19. // CHECK:STDOUT: %.3: i32 = int_literal 1 [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .Core = %Core
  25. // CHECK:STDOUT: .Main = %Main.decl
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  28. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {}
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: fn @Main() {
  32. // CHECK:STDOUT: !entry:
  33. // CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 [template = constants.%.2]
  34. // CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 [template = constants.%.3]
  35. // CHECK:STDOUT: return
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: