fail_too_few_element.carbon 1.6 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. // CHECK:STDERR: fail_too_few_element.carbon:[[@LINE+3]]:21: ERROR: Cannot initialize tuple of 2 element(s) from tuple with 1 element(s).
  7. // CHECK:STDERR: var x: (i32, i32) = (2, );
  8. // CHECK:STDERR: ^~~~~
  9. var x: (i32, i32) = (2, );
  10. // CHECK:STDOUT: --- fail_too_few_element.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: constants {
  13. // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template]
  14. // CHECK:STDOUT: %.2: type = tuple_type (i32, i32) [template]
  15. // CHECK:STDOUT: %.3: type = ptr_type (i32, i32) [template]
  16. // CHECK:STDOUT: %.4: i32 = int_literal 2 [template]
  17. // CHECK:STDOUT: %.5: type = tuple_type (i32) [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .x = %x
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32)
  25. // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.2 [template = constants.%.2]
  26. // CHECK:STDOUT: %x.var: ref (i32, i32) = var x
  27. // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT:
  30. // CHECK:STDOUT: fn @__global_init() {
  31. // CHECK:STDOUT: !entry:
  32. // CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 [template = constants.%.4]
  33. // CHECK:STDOUT: %.loc10_25: (i32,) = tuple_literal (%.loc10_22)
  34. // CHECK:STDOUT: assign file.%x.var, <error>
  35. // CHECK:STDOUT: return
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: