form.carbon 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/form.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/form.carbon
  12. // --- ref_form_param.carbon
  13. library "[[@TEST_NAME]]";
  14. //@dump-sem-ir-begin
  15. fn F(x:? form(ref i32));
  16. //@dump-sem-ir-end
  17. fn G() {
  18. var y: i32 = 0;
  19. //@dump-sem-ir-begin
  20. F(ref y);
  21. //@dump-sem-ir-end
  22. }
  23. // --- var_form_param.carbon
  24. library "[[@TEST_NAME]]";
  25. //@dump-sem-ir-begin
  26. fn F(x:? form(var i32));
  27. //@dump-sem-ir-end
  28. fn G() {
  29. //@dump-sem-ir-begin
  30. F(0);
  31. //@dump-sem-ir-end
  32. }
  33. // --- val_form_param.carbon
  34. library "[[@TEST_NAME]]";
  35. //@dump-sem-ir-begin
  36. fn F(x:? form(val i32));
  37. //@dump-sem-ir-end
  38. fn G() {
  39. //@dump-sem-ir-begin
  40. F(0);
  41. //@dump-sem-ir-end
  42. }
  43. // --- type_component_needs_conversion.carbon
  44. library "[[@TEST_NAME]]";
  45. //@dump-sem-ir-begin
  46. fn F(x:? form(ref ()));
  47. //@dump-sem-ir-end
  48. // --- fail_param_form_not_constant.carbon
  49. library "[[@TEST_NAME]]";
  50. fn F() -> Core.Form();
  51. // CHECK:STDERR: fail_param_form_not_constant.carbon:[[@LINE+4]]:10: error: cannot evaluate form expression [FormExprEvaluationFailure]
  52. // CHECK:STDERR: fn G(x:? F());
  53. // CHECK:STDERR: ^~~
  54. // CHECK:STDERR:
  55. fn G(x:? F());
  56. // --- fail_form_param_not_form.carbon
  57. library "[[@TEST_NAME]]";
  58. // CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `type` to `Core.Form` [ConversionFailure]
  59. // CHECK:STDERR: fn F(x:? i32);
  60. // CHECK:STDERR: ^~~
  61. // CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:10: note: type `type` does not implement interface `Core.ImplicitAs(Core.Form)` [MissingImplInMemberAccessInContext]
  62. // CHECK:STDERR: fn F(x:? i32);
  63. // CHECK:STDERR: ^~~
  64. // CHECK:STDERR:
  65. fn F(x:? i32);
  66. // CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+8]]:6: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  67. // CHECK:STDERR: fn G(ref x:? i32);
  68. // CHECK:STDERR: ^~~~~
  69. // CHECK:STDERR:
  70. // CHECK:STDERR: fail_form_param_not_form.carbon:[[@LINE+4]]:6: error: expected `:` binding after `ref` [ExpectedRuntimeBindingPatternAfterRef]
  71. // CHECK:STDERR: fn G(ref x:? i32);
  72. // CHECK:STDERR: ^~~
  73. // CHECK:STDERR:
  74. fn G(ref x:? i32);
  75. // --- fail_missing_ref_tag.carbon
  76. library "[[@TEST_NAME]]";
  77. fn F(x:? form(ref i32));
  78. fn G() {
  79. var y: i32 = 0;
  80. // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE+7]]:5: error: argument to `ref` parameter not marked with `ref` [RefParamNoRefTag]
  81. // CHECK:STDERR: F(y);
  82. // CHECK:STDERR: ^
  83. // CHECK:STDERR: fail_missing_ref_tag.carbon:[[@LINE-7]]:6: note: initializing function parameter [InCallToFunctionParam]
  84. // CHECK:STDERR: fn F(x:? form(ref i32));
  85. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  86. // CHECK:STDERR:
  87. F(y);
  88. }
  89. // --- fail_todo_form_generic_param.carbon
  90. library "[[@TEST_NAME]]";
  91. // CHECK:STDERR: fail_todo_form_generic_param.carbon:[[@LINE+4]]:26: error: semantics TODO: `Support symbolic form bindings` [SemanticsTodo]
  92. // CHECK:STDERR: fn F(Form:! Core.Form(), x:? Form);
  93. // CHECK:STDERR: ^~~~~~~~
  94. // CHECK:STDERR:
  95. fn F(Form:! Core.Form(), x:? Form);
  96. fn G() {
  97. var x: i32;
  98. F(form(var i32), x);
  99. }
  100. // --- fail_todo_local_init_form_binding.carbon
  101. library "[[@TEST_NAME]]";
  102. fn F() {
  103. // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+12]]:7: error: semantics TODO: `Support local initializing forms` [SemanticsTodo]
  104. // CHECK:STDERR: let x:? form(var i32) = 0;
  105. // CHECK:STDERR: ^
  106. // CHECK:STDERR:
  107. // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+8]]:27: error: cannot bind durable reference to non-reference value of type `i32` [ConversionFailureNonRefToRef]
  108. // CHECK:STDERR: let x:? form(var i32) = 0;
  109. // CHECK:STDERR: ^
  110. // CHECK:STDERR:
  111. // CHECK:STDERR: fail_todo_local_init_form_binding.carbon:[[@LINE+4]]:7: warning: binding `x` unused [UnusedBinding]
  112. // CHECK:STDERR: let x:? form(var i32) = 0;
  113. // CHECK:STDERR: ^
  114. // CHECK:STDERR:
  115. let x:? form(var i32) = 0;
  116. }
  117. // --- fail_todo_local_symbolic_form_binding.carbon
  118. library "[[@TEST_NAME]]";
  119. // TODO: this code should fail for a different reason, but right now we don't
  120. // have a way to write correct code that reaches the TODO we're exercising here.
  121. fn F(Form:! Core.Form()) {
  122. // CHECK:STDERR: fail_todo_local_symbolic_form_binding.carbon:[[@LINE+4]]:7: error: semantics TODO: `Support symbolic form bindings` [SemanticsTodo]
  123. // CHECK:STDERR: let y:? Form = 0;
  124. // CHECK:STDERR: ^~~~~~~~
  125. // CHECK:STDERR:
  126. let y:? Form = 0;
  127. }
  128. // --- fail_todo_ref_return_form.carbon
  129. library "[[@TEST_NAME]]";
  130. //@dump-sem-ir-begin
  131. // CHECK:STDERR: fail_todo_ref_return_form.carbon:[[@LINE+4]]:8: error: semantics TODO: `Support ->?` [SemanticsTodo]
  132. // CHECK:STDERR: fn F() ->? form(ref i32);
  133. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  134. // CHECK:STDERR:
  135. fn F() ->? form(ref i32);
  136. //@dump-sem-ir-end
  137. fn G() {
  138. //@dump-sem-ir-begin
  139. let ref x: i32 = F();
  140. //@dump-sem-ir-end
  141. }
  142. // --- fail_todo_var_return_form.carbon
  143. library "[[@TEST_NAME]]";
  144. //@dump-sem-ir-begin
  145. // CHECK:STDERR: fail_todo_var_return_form.carbon:[[@LINE+4]]:8: error: semantics TODO: `Support ->?` [SemanticsTodo]
  146. // CHECK:STDERR: fn F() ->? form(var i32);
  147. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  148. // CHECK:STDERR:
  149. fn F() ->? form(var i32);
  150. //@dump-sem-ir-end
  151. fn G() {
  152. //@dump-sem-ir-begin
  153. let var x: i32 = F();
  154. //@dump-sem-ir-end
  155. }
  156. // --- fail_todo_val_return_form.carbon
  157. library "[[@TEST_NAME]]";
  158. //@dump-sem-ir-begin
  159. // CHECK:STDERR: fail_todo_val_return_form.carbon:[[@LINE+4]]:8: error: semantics TODO: `Support ->?` [SemanticsTodo]
  160. // CHECK:STDERR: fn F() ->? form(val i32);
  161. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  162. // CHECK:STDERR:
  163. fn F() ->? form(val i32);
  164. //@dump-sem-ir-end
  165. fn G() {
  166. //@dump-sem-ir-begin
  167. let x: i32 = F();
  168. //@dump-sem-ir-end
  169. }
  170. // --- fail_return_form_not_form.carbon
  171. library "[[@TEST_NAME]]";
  172. // CHECK:STDERR: fail_return_form_not_form.carbon:[[@LINE+4]]:8: error: semantics TODO: `Support ->?` [SemanticsTodo]
  173. // CHECK:STDERR: fn F() ->? i32;
  174. // CHECK:STDERR: ^~~~~~~
  175. // CHECK:STDERR:
  176. fn F() ->? i32;
  177. fn F() ->? ref i32;
  178. // CHECK:STDOUT: --- ref_form_param.carbon
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: constants {
  181. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  182. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  183. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  184. // CHECK:STDOUT: %.1da: Core.Form = ref_form %i32 [concrete]
  185. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  186. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  187. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: file {
  191. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  192. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = form_binding_pattern x [concrete]
  193. // CHECK:STDOUT: %.loc4_7: %pattern_type.7ce = form_param_pattern %x.patt [concrete]
  194. // CHECK:STDOUT: } {
  195. // CHECK:STDOUT: %x.param: ref %i32 = ref_param call_param0
  196. // CHECK:STDOUT: %.loc4_15.1: Core.Form = splice_block %.loc4_15.2 [concrete = constants.%.1da] {
  197. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  198. // CHECK:STDOUT: %.loc4_15.2: Core.Form = ref_form %i32 [concrete = constants.%.1da]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %x: ref %i32 = form_binding x, %x.param
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: fn @F(%x.param: ref %i32);
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: fn @G() {
  207. // CHECK:STDOUT: !entry:
  208. // CHECK:STDOUT: <elided>
  209. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  210. // CHECK:STDOUT: %y.ref: ref %i32 = name_ref y, %y
  211. // CHECK:STDOUT: %.loc10: %i32 = ref_tag %y.ref
  212. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc10)
  213. // CHECK:STDOUT: <elided>
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: --- var_form_param.carbon
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: constants {
  219. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  220. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  221. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  222. // CHECK:STDOUT: %.ff5: Core.Form = init_form %i32 [concrete]
  223. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  224. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  225. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  226. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  227. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  228. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  229. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  230. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  231. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  232. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  233. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  234. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  235. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b37: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%i32, %ImplicitAs.facet) [concrete]
  236. // CHECK:STDOUT: %.545: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.b37, %ImplicitAs.facet [concrete]
  237. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  238. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  239. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  240. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  241. // CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
  242. // CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: imports {
  246. // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
  247. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: file {
  251. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  252. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = form_binding_pattern x [concrete]
  253. // CHECK:STDOUT: %.loc4_7: %pattern_type.7ce = form_param_pattern %x.patt [concrete]
  254. // CHECK:STDOUT: } {
  255. // CHECK:STDOUT: %x.param: ref %i32 = ref_param call_param0
  256. // CHECK:STDOUT: %.loc4_15.1: Core.Form = splice_block %.loc4_15.2 [concrete = constants.%.ff5] {
  257. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  258. // CHECK:STDOUT: %.loc4_15.2: Core.Form = init_form %i32 [concrete = constants.%.ff5]
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT: %x: ref %i32 = form_binding x, %x.param
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: fn @F(%x.param: ref %i32);
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: fn @G() {
  267. // CHECK:STDOUT: !entry:
  268. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  269. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  270. // CHECK:STDOUT: %.loc4_7.1: ref %i32 = temporary_storage
  271. // CHECK:STDOUT: %impl.elem0: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  272. // CHECK:STDOUT: %bound_method.loc4_7.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  273. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  274. // CHECK:STDOUT: %bound_method.loc4_7.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
  275. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc4_7.2(%int_0) [concrete = constants.%int_0.6a9]
  276. // CHECK:STDOUT: %.loc4_7.2: init %i32 = converted %int_0, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  277. // CHECK:STDOUT: %.loc4_7.3: ref %i32 = temporary %.loc4_7.1, %.loc4_7.2
  278. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc4_7.3)
  279. // CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc4_7.3, constants.%Destroy.Op
  280. // CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc4_7.3)
  281. // CHECK:STDOUT: <elided>
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: fn @Destroy.Op(%self.param: ref %i32) = "no_op";
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: --- val_form_param.carbon
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: constants {
  289. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  290. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  291. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  292. // CHECK:STDOUT: %.754: Core.Form = value_form %i32 [concrete]
  293. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  294. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  295. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  296. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  297. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  298. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  299. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  300. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  301. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  302. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  303. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  304. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  305. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b37: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%i32, %ImplicitAs.facet) [concrete]
  306. // CHECK:STDOUT: %.545: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.b37, %ImplicitAs.facet [concrete]
  307. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  308. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  309. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  310. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: imports {
  314. // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
  315. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT:
  318. // CHECK:STDOUT: file {
  319. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  320. // CHECK:STDOUT: %x.patt: %pattern_type.7ce = form_binding_pattern x [concrete]
  321. // CHECK:STDOUT: %.loc4_7: %pattern_type.7ce = form_param_pattern %x.patt [concrete]
  322. // CHECK:STDOUT: } {
  323. // CHECK:STDOUT: %x.param: %i32 = value_param call_param0
  324. // CHECK:STDOUT: %.loc4_15.1: Core.Form = splice_block %.loc4_15.2 [concrete = constants.%.754] {
  325. // CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
  326. // CHECK:STDOUT: %.loc4_15.2: Core.Form = value_form %i32 [concrete = constants.%.754]
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT: %x: %i32 = form_binding x, %x.param
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: fn @F(%x.param: %i32);
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: fn @G() {
  335. // CHECK:STDOUT: !entry:
  336. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  337. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  338. // CHECK:STDOUT: %impl.elem0: %.545 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  339. // CHECK:STDOUT: %bound_method.loc9_5.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  340. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  341. // CHECK:STDOUT: %bound_method.loc9_5.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
  342. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc9_5.2(%int_0) [concrete = constants.%int_0.6a9]
  343. // CHECK:STDOUT: %.loc9_5.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
  344. // CHECK:STDOUT: %.loc9_5.2: %i32 = converted %int_0, %.loc9_5.1 [concrete = constants.%int_0.6a9]
  345. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc9_5.2)
  346. // CHECK:STDOUT: <elided>
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: --- type_component_needs_conversion.carbon
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: constants {
  352. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  353. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  354. // CHECK:STDOUT: %.9f9: Core.Form = ref_form %empty_tuple.type [concrete]
  355. // CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
  356. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  357. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: file {
  361. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  362. // CHECK:STDOUT: %x.patt: %pattern_type = form_binding_pattern x [concrete]
  363. // CHECK:STDOUT: %.loc4_7: %pattern_type = form_param_pattern %x.patt [concrete]
  364. // CHECK:STDOUT: } {
  365. // CHECK:STDOUT: %x.param: ref %empty_tuple.type = ref_param call_param0
  366. // CHECK:STDOUT: %.loc4_15.1: Core.Form = splice_block %.loc4_15.2 [concrete = constants.%.9f9] {
  367. // CHECK:STDOUT: %.loc4_20.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  368. // CHECK:STDOUT: %.loc4_20.2: type = converted %.loc4_20.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  369. // CHECK:STDOUT: %.loc4_15.2: Core.Form = ref_form %.loc4_20.2 [concrete = constants.%.9f9]
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT: %x: ref %empty_tuple.type = form_binding x, %x.param
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: fn @F(%x.param: ref %empty_tuple.type);
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: --- fail_todo_ref_return_form.carbon
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: --- fail_todo_var_return_form.carbon
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: --- fail_todo_val_return_form.carbon
  382. // CHECK:STDOUT: