fail_assign_nested.carbon 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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]]:19: 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: --- fail_assign_nested.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: constants {
  13. // CHECK:STDOUT: %.loc10_14.1: type = struct_type {}, const
  14. // CHECK:STDOUT: %.loc10_14.2: type = tuple_type (), const
  15. // CHECK:STDOUT: %.loc10_15: type = struct_type {.a: ()}, const
  16. // CHECK:STDOUT: %.loc10_27: type = struct_type {.b: {}}, const
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace package, {.x = %x}
  21. // CHECK:STDOUT: %.loc10_14.1: {} = struct_literal ()
  22. // CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.loc10_14.1, const = constants.%.loc10_14.1
  23. // CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}}, const
  24. // CHECK:STDOUT: %x.var: ref {.a: {}} = var x
  25. // CHECK:STDOUT: %x: ref {.a: {}} = bind_name x, %x.var
  26. // CHECK:STDOUT: %.loc10_26: {} = struct_literal ()
  27. // CHECK:STDOUT: %.loc10_27: {.b: {}} = struct_literal (%.loc10_26)
  28. // CHECK:STDOUT: assign %x.var, <error>
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: