fail_assign_nested.carbon 1.3 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_nested.carbon:[[@LINE+3]]:27: ERROR: Missing value for field `a` in struct initialization.
  7. // CHECK:STDERR: var x: {.a: {}} = {.b = {}};
  8. // CHECK:STDERR: ^
  9. var x: {.a: {}} = {.b = {}};
  10. // CHECK:STDOUT: constants {
  11. // CHECK:STDOUT: %.loc10_14.1: type = struct_type {}
  12. // CHECK:STDOUT: %.loc10_14.2: type = tuple_type ()
  13. // CHECK:STDOUT: %.loc10_15: type = struct_type {.a: ()}
  14. // CHECK:STDOUT: %.loc10_27: type = struct_type {.b: {}}
  15. // CHECK:STDOUT: }
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: file "fail_assign_nested.carbon" {
  18. // CHECK:STDOUT: %.loc10_14.1: {} = struct_literal ()
  19. // CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.loc10_14.1
  20. // CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}}
  21. // CHECK:STDOUT: %x.var: ref {.a: {}} = var x
  22. // CHECK:STDOUT: %x: ref {.a: {}} = bind_name x, %x.var
  23. // CHECK:STDOUT: %.loc10_26: {} = struct_literal ()
  24. // CHECK:STDOUT: %.loc10_27: {.b: {}} = struct_literal (%.loc10_26)
  25. // CHECK:STDOUT: assign %x.var, <error>
  26. // CHECK:STDOUT: }