fail_too_few_element.carbon 1.4 KB

12345678910111213141516171819202122232425262728293031
  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: %.loc10_17.1: type = tuple_type (type, type)
  14. // CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32)
  15. // CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32)
  16. // CHECK:STDOUT: %.loc10_25: type = tuple_type (i32)
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace {.x = %x}
  21. // CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32)
  22. // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.loc10_17.2
  23. // CHECK:STDOUT: %x.var: ref (i32, i32) = var x
  24. // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var
  25. // CHECK:STDOUT: %.loc10_22: i32 = int_literal 2
  26. // CHECK:STDOUT: %.loc10_25: (i32,) = tuple_literal (%.loc10_22)
  27. // CHECK:STDOUT: assign %x.var, <error>
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: