fail_convert_to_invalid.carbon 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. class C {
  7. // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+3]]:10: ERROR: Name `NoSuchType` not found.
  8. // CHECK:STDERR: var a: NoSuchType;
  9. // CHECK:STDERR: ^~~~~~~~~~
  10. var a: NoSuchType;
  11. }
  12. fn Make() -> C {
  13. return {.a = 123};
  14. }
  15. // CHECK:STDOUT: --- fail_convert_to_invalid.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %C: type = class_type @C [template]
  19. // CHECK:STDOUT: %.1: i32 = int_literal 123 [template]
  20. // CHECK:STDOUT: %.2: type = struct_type {.a: i32} [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .C = %C.decl
  26. // CHECK:STDOUT: .Make = %Make
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  29. // CHECK:STDOUT: %Make: <function> = fn_decl @Make [template] {
  30. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  31. // CHECK:STDOUT: @Make.%return: ref C = var <return slot>
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: class @C {
  36. // CHECK:STDOUT: %NoSuchType.ref: <error> = name_ref NoSuchType, <error> [template = <error>]
  37. // CHECK:STDOUT: %.loc11: <error> = field_decl a, element0 [template]
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: !members:
  40. // CHECK:STDOUT: .Self = constants.%C
  41. // CHECK:STDOUT: .a = %.loc11
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @Make() -> %return: C {
  45. // CHECK:STDOUT: !entry:
  46. // CHECK:STDOUT: %.loc15_16: i32 = int_literal 123 [template = constants.%.1]
  47. // CHECK:STDOUT: %.loc15_19: {.a: i32} = struct_literal (%.loc15_16)
  48. // CHECK:STDOUT: return <error>
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: