fail_assign_to_empty.carbon 1.1 KB

12345678910111213141516171819202122232425262728
  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_assign_to_empty.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `i32` to `()`.
  7. // CHECK:STDERR: var x: () = (66);
  8. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  9. var x: () = (66);
  10. // CHECK:STDOUT: --- fail_assign_to_empty.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: constants {
  13. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  14. // CHECK:STDOUT: %.2: i32 = int_literal 66 [template]
  15. // CHECK:STDOUT: }
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: file {
  18. // CHECK:STDOUT: package: <namespace> = namespace package, {.x = %x} [template]
  19. // CHECK:STDOUT: %.loc10_9.1: () = tuple_literal ()
  20. // CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.1 [template = constants.%.1]
  21. // CHECK:STDOUT: %x.var: ref () = var x
  22. // CHECK:STDOUT: %x: ref () = bind_name x, %x.var
  23. // CHECK:STDOUT: %.loc10_14: i32 = int_literal 66 [template = constants.%.2]
  24. // CHECK:STDOUT: assign %x.var, <error>
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT: