init_adapt.carbon 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/init_adapt.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/init_adapt.carbon
  10. // --- init_adapt.carbon
  11. library "init_adapt";
  12. class C {
  13. var a: i32;
  14. var b: i32;
  15. }
  16. class AdaptC {
  17. adapt C;
  18. }
  19. let a: C = {.a = 1, .b = 2};
  20. let b: AdaptC = a as AdaptC;
  21. let c: C = b as C;
  22. fn MakeC() -> C;
  23. fn MakeAdaptC() -> AdaptC;
  24. var d: AdaptC = MakeC() as AdaptC;
  25. var e: C = MakeAdaptC() as C;
  26. // --- fail_not_implicit.carbon
  27. library "fail_not_implicit";
  28. class C {
  29. var a: i32;
  30. var b: i32;
  31. }
  32. class AdaptC {
  33. adapt C;
  34. }
  35. let a: C = {.a = 1, .b = 2};
  36. // Cannot implicitly convert between a type and an adapter for the type.
  37. // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: ERROR: Cannot implicitly convert from `C` to `AdaptC`.
  38. // CHECK:STDERR: let b: AdaptC = a;
  39. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  40. // CHECK:STDERR:
  41. let b: AdaptC = a;
  42. // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: ERROR: Cannot implicitly convert from `AdaptC` to `C`.
  43. // CHECK:STDERR: let c: C = b;
  44. // CHECK:STDERR: ^~~~~~~~~~~~~
  45. // CHECK:STDERR:
  46. let c: C = b;
  47. fn MakeC() -> C;
  48. fn MakeAdaptC() -> AdaptC;
  49. // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+4]]:1: ERROR: Cannot implicitly convert from `C` to `AdaptC`.
  50. // CHECK:STDERR: var d: AdaptC = MakeC();
  51. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  52. // CHECK:STDERR:
  53. var d: AdaptC = MakeC();
  54. // CHECK:STDERR: fail_not_implicit.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `AdaptC` to `C`.
  55. // CHECK:STDERR: var e: C = MakeAdaptC();
  56. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  57. var e: C = MakeAdaptC();
  58. // CHECK:STDOUT: --- init_adapt.carbon
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: constants {
  61. // CHECK:STDOUT: %C: type = class_type @C [template]
  62. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  63. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  64. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  65. // CHECK:STDOUT: %.2: type = unbound_element_type %C, i32 [template]
  66. // CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template]
  67. // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template]
  68. // CHECK:STDOUT: %.4: type = ptr_type %.3 [template]
  69. // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
  70. // CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
  71. // CHECK:STDOUT: %struct: %C = struct_value (%.5, %.6) [template]
  72. // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template]
  73. // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template]
  74. // CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [template]
  75. // CHECK:STDOUT: %MakeAdaptC: %MakeAdaptC.type = struct_value () [template]
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: file {
  79. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  80. // CHECK:STDOUT: .Core = %Core
  81. // CHECK:STDOUT: .C = %C.decl
  82. // CHECK:STDOUT: .AdaptC = %AdaptC.decl
  83. // CHECK:STDOUT: .a = @__global_init.%a
  84. // CHECK:STDOUT: .b = @__global_init.%b
  85. // CHECK:STDOUT: .c = @__global_init.%c
  86. // CHECK:STDOUT: .MakeC = %MakeC.decl
  87. // CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl
  88. // CHECK:STDOUT: .d = %d
  89. // CHECK:STDOUT: .e = %e
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  92. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  93. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  94. // CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  95. // CHECK:STDOUT: %AdaptC.decl: type = class_decl @AdaptC [template = constants.%AdaptC] {}
  96. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C]
  97. // CHECK:STDOUT: %AdaptC.ref.loc15: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  98. // CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C]
  99. // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [template = constants.%MakeC] {
  100. // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C]
  101. // CHECK:STDOUT: @MakeC.%return: ref %C = var <return slot>
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %MakeAdaptC.decl: %MakeAdaptC.type = fn_decl @MakeAdaptC [template = constants.%MakeAdaptC] {
  104. // CHECK:STDOUT: %AdaptC.ref.loc21: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  105. // CHECK:STDOUT: @MakeAdaptC.%return: ref %AdaptC = var <return slot>
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: %AdaptC.ref.loc23: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  108. // CHECK:STDOUT: %d.var: ref %AdaptC = var d
  109. // CHECK:STDOUT: %d: ref %AdaptC = bind_name d, %d.var
  110. // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C]
  111. // CHECK:STDOUT: %e.var: ref %C = var e
  112. // CHECK:STDOUT: %e: ref %C = bind_name e, %e.var
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: class @C {
  116. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  117. // CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  118. // CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32]
  119. // CHECK:STDOUT: %.loc5_8: %.2 = field_decl a, element0 [template]
  120. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  121. // CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  122. // CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32]
  123. // CHECK:STDOUT: %.loc6_8: %.2 = field_decl b, element1 [template]
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: !members:
  126. // CHECK:STDOUT: .Self = constants.%C
  127. // CHECK:STDOUT: .a = %.loc5_8
  128. // CHECK:STDOUT: .b = %.loc6_8
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: class @AdaptC {
  132. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  133. // CHECK:STDOUT: adapt_decl %C
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: !members:
  136. // CHECK:STDOUT: .Self = constants.%AdaptC
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: fn @MakeC() -> %C;
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: fn @MakeAdaptC() -> %AdaptC;
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: fn @__global_init() {
  146. // CHECK:STDOUT: !entry:
  147. // CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.5]
  148. // CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.6]
  149. // CHECK:STDOUT: %.loc13_27.1: %.3 = struct_literal (%.loc13_18, %.loc13_26)
  150. // CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage
  151. // CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0
  152. // CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.5]
  153. // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1
  154. // CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.6]
  155. // CHECK:STDOUT: %.loc13_27.7: init %C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct]
  156. // CHECK:STDOUT: %.loc13_27.8: ref %C = temporary %.loc13_27.2, %.loc13_27.7
  157. // CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.8
  158. // CHECK:STDOUT: %.loc13_28.2: %C = bind_value %.loc13_28.1
  159. // CHECK:STDOUT: %a: %C = bind_name a, %.loc13_28.2
  160. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  161. // CHECK:STDOUT: %AdaptC.ref.loc15: type = name_ref AdaptC, file.%AdaptC.decl [template = constants.%AdaptC]
  162. // CHECK:STDOUT: %.loc15_19.1: %AdaptC = as_compatible %a.ref
  163. // CHECK:STDOUT: %.loc15_19.2: %AdaptC = converted %a.ref, %.loc15_19.1
  164. // CHECK:STDOUT: %b: %AdaptC = bind_name b, %.loc15_19.2
  165. // CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, %b
  166. // CHECK:STDOUT: %C.ref.loc17: type = name_ref C, file.%C.decl [template = constants.%C]
  167. // CHECK:STDOUT: %.loc17_14.1: %C = as_compatible %b.ref
  168. // CHECK:STDOUT: %.loc17_14.2: %C = converted %b.ref, %.loc17_14.1
  169. // CHECK:STDOUT: %c: %C = bind_name c, %.loc17_14.2
  170. // CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [template = constants.%MakeC]
  171. // CHECK:STDOUT: %.loc23_5: ref %AdaptC = splice_block file.%d.var {}
  172. // CHECK:STDOUT: %MakeC.call: init %C = call %MakeC.ref() to %.loc23_5
  173. // CHECK:STDOUT: %AdaptC.ref.loc23: type = name_ref AdaptC, file.%AdaptC.decl [template = constants.%AdaptC]
  174. // CHECK:STDOUT: %.loc23_25.1: init %AdaptC = as_compatible %MakeC.call
  175. // CHECK:STDOUT: %.loc23_25.2: init %AdaptC = converted %MakeC.call, %.loc23_25.1
  176. // CHECK:STDOUT: assign file.%d.var, %.loc23_25.2
  177. // CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%MakeAdaptC]
  178. // CHECK:STDOUT: %.loc25_5: ref %C = splice_block file.%e.var {}
  179. // CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC = call %MakeAdaptC.ref() to %.loc25_5
  180. // CHECK:STDOUT: %C.ref.loc25: type = name_ref C, file.%C.decl [template = constants.%C]
  181. // CHECK:STDOUT: %.loc25_25.1: init %C = as_compatible %MakeAdaptC.call
  182. // CHECK:STDOUT: %.loc25_25.2: init %C = converted %MakeAdaptC.call, %.loc25_25.1
  183. // CHECK:STDOUT: assign file.%e.var, %.loc25_25.2
  184. // CHECK:STDOUT: return
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: --- fail_not_implicit.carbon
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: constants {
  190. // CHECK:STDOUT: %C: type = class_type @C [template]
  191. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  192. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  193. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  194. // CHECK:STDOUT: %.2: type = unbound_element_type %C, i32 [template]
  195. // CHECK:STDOUT: %.3: type = struct_type {.a: i32, .b: i32} [template]
  196. // CHECK:STDOUT: %AdaptC: type = class_type @AdaptC [template]
  197. // CHECK:STDOUT: %.4: type = ptr_type %.3 [template]
  198. // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
  199. // CHECK:STDOUT: %.6: i32 = int_literal 2 [template]
  200. // CHECK:STDOUT: %struct: %C = struct_value (%.5, %.6) [template]
  201. // CHECK:STDOUT: %MakeC.type: type = fn_type @MakeC [template]
  202. // CHECK:STDOUT: %MakeC: %MakeC.type = struct_value () [template]
  203. // CHECK:STDOUT: %MakeAdaptC.type: type = fn_type @MakeAdaptC [template]
  204. // CHECK:STDOUT: %MakeAdaptC: %MakeAdaptC.type = struct_value () [template]
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: file {
  208. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  209. // CHECK:STDOUT: .Core = %Core
  210. // CHECK:STDOUT: .C = %C.decl
  211. // CHECK:STDOUT: .AdaptC = %AdaptC.decl
  212. // CHECK:STDOUT: .a = @__global_init.%a
  213. // CHECK:STDOUT: .b = @__global_init.%b
  214. // CHECK:STDOUT: .c = @__global_init.%c
  215. // CHECK:STDOUT: .MakeC = %MakeC.decl
  216. // CHECK:STDOUT: .MakeAdaptC = %MakeAdaptC.decl
  217. // CHECK:STDOUT: .d = %d
  218. // CHECK:STDOUT: .e = %e
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  221. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  222. // CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  223. // CHECK:STDOUT: %import_ref.2: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  224. // CHECK:STDOUT: %AdaptC.decl: type = class_decl @AdaptC [template = constants.%AdaptC] {}
  225. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C]
  226. // CHECK:STDOUT: %AdaptC.ref.loc21: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  227. // CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C]
  228. // CHECK:STDOUT: %MakeC.decl: %MakeC.type = fn_decl @MakeC [template = constants.%MakeC] {
  229. // CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C]
  230. // CHECK:STDOUT: @MakeC.%return: ref %C = var <return slot>
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT: %MakeAdaptC.decl: %MakeAdaptC.type = fn_decl @MakeAdaptC [template = constants.%MakeAdaptC] {
  233. // CHECK:STDOUT: %AdaptC.ref.loc31: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  234. // CHECK:STDOUT: @MakeAdaptC.%return: ref %AdaptC = var <return slot>
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT: %AdaptC.ref.loc37: type = name_ref AdaptC, %AdaptC.decl [template = constants.%AdaptC]
  237. // CHECK:STDOUT: %d.var: ref %AdaptC = var d
  238. // CHECK:STDOUT: %d: ref %AdaptC = bind_name d, %d.var
  239. // CHECK:STDOUT: %C.ref.loc42: type = name_ref C, %C.decl [template = constants.%C]
  240. // CHECK:STDOUT: %e.var: ref %C = var e
  241. // CHECK:STDOUT: %e: ref %C = bind_name e, %e.var
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: class @C {
  245. // CHECK:STDOUT: %int.make_type_32.loc5: init type = call constants.%Int32() [template = i32]
  246. // CHECK:STDOUT: %.loc5_10.1: type = value_of_initializer %int.make_type_32.loc5 [template = i32]
  247. // CHECK:STDOUT: %.loc5_10.2: type = converted %int.make_type_32.loc5, %.loc5_10.1 [template = i32]
  248. // CHECK:STDOUT: %.loc5_8: %.2 = field_decl a, element0 [template]
  249. // CHECK:STDOUT: %int.make_type_32.loc6: init type = call constants.%Int32() [template = i32]
  250. // CHECK:STDOUT: %.loc6_10.1: type = value_of_initializer %int.make_type_32.loc6 [template = i32]
  251. // CHECK:STDOUT: %.loc6_10.2: type = converted %int.make_type_32.loc6, %.loc6_10.1 [template = i32]
  252. // CHECK:STDOUT: %.loc6_8: %.2 = field_decl b, element1 [template]
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: !members:
  255. // CHECK:STDOUT: .Self = constants.%C
  256. // CHECK:STDOUT: .a = %.loc5_8
  257. // CHECK:STDOUT: .b = %.loc6_8
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: class @AdaptC {
  261. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  262. // CHECK:STDOUT: adapt_decl %C
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: !members:
  265. // CHECK:STDOUT: .Self = constants.%AdaptC
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: fn @MakeC() -> %C;
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: fn @MakeAdaptC() -> %AdaptC;
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: fn @__global_init() {
  275. // CHECK:STDOUT: !entry:
  276. // CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.5]
  277. // CHECK:STDOUT: %.loc13_26: i32 = int_literal 2 [template = constants.%.6]
  278. // CHECK:STDOUT: %.loc13_27.1: %.3 = struct_literal (%.loc13_18, %.loc13_26)
  279. // CHECK:STDOUT: %.loc13_27.2: ref %C = temporary_storage
  280. // CHECK:STDOUT: %.loc13_27.3: ref i32 = class_element_access %.loc13_27.2, element0
  281. // CHECK:STDOUT: %.loc13_27.4: init i32 = initialize_from %.loc13_18 to %.loc13_27.3 [template = constants.%.5]
  282. // CHECK:STDOUT: %.loc13_27.5: ref i32 = class_element_access %.loc13_27.2, element1
  283. // CHECK:STDOUT: %.loc13_27.6: init i32 = initialize_from %.loc13_26 to %.loc13_27.5 [template = constants.%.6]
  284. // CHECK:STDOUT: %.loc13_27.7: init %C = class_init (%.loc13_27.4, %.loc13_27.6), %.loc13_27.2 [template = constants.%struct]
  285. // CHECK:STDOUT: %.loc13_27.8: ref %C = temporary %.loc13_27.2, %.loc13_27.7
  286. // CHECK:STDOUT: %.loc13_28.1: ref %C = converted %.loc13_27.1, %.loc13_27.8
  287. // CHECK:STDOUT: %.loc13_28.2: %C = bind_value %.loc13_28.1
  288. // CHECK:STDOUT: %a: %C = bind_name a, %.loc13_28.2
  289. // CHECK:STDOUT: %a.ref: %C = name_ref a, %a
  290. // CHECK:STDOUT: %b: %AdaptC = bind_name b, <error>
  291. // CHECK:STDOUT: %b.ref: %AdaptC = name_ref b, %b
  292. // CHECK:STDOUT: %c: %C = bind_name c, <error>
  293. // CHECK:STDOUT: %MakeC.ref: %MakeC.type = name_ref MakeC, file.%MakeC.decl [template = constants.%MakeC]
  294. // CHECK:STDOUT: %.loc37: ref %C = temporary_storage
  295. // CHECK:STDOUT: %MakeC.call: init %C = call %MakeC.ref() to %.loc37
  296. // CHECK:STDOUT: assign file.%d.var, <error>
  297. // CHECK:STDOUT: %MakeAdaptC.ref: %MakeAdaptC.type = name_ref MakeAdaptC, file.%MakeAdaptC.decl [template = constants.%MakeAdaptC]
  298. // CHECK:STDOUT: %.loc42: ref %AdaptC = temporary_storage
  299. // CHECK:STDOUT: %MakeAdaptC.call: init %AdaptC = call %MakeAdaptC.ref() to %.loc42
  300. // CHECK:STDOUT: assign file.%e.var, <error>
  301. // CHECK:STDOUT: return
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT: