unimplemented.carbon 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/generic/template/unimplemented.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/generic/template/unimplemented.carbon
  13. // --- fail_todo_unimplemented_operator.carbon
  14. library "[[@TEST_NAME]]";
  15. // Check that we get a reasonable diagnostic for an unimplemented operation on a
  16. // template dependent expression.
  17. fn F[template T:! type](x: T) -> i32 {
  18. // CHECK:STDERR: fail_todo_unimplemented_operator.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.MulWith(Core.IntLiteral)` in type `<dependent type>` that does not implement that interface [MissingImplInMemberAccess]
  19. // CHECK:STDERR: return x.n * 3;
  20. // CHECK:STDERR: ^~~~~~~
  21. // CHECK:STDERR:
  22. return x.n * 3;
  23. }
  24. // --- fail_todo_unimplemented_value.carbon
  25. library "[[@TEST_NAME]]";
  26. class C {
  27. var n: i32;
  28. }
  29. // Check that we get a reasonable diagnostic for an unimplemented operation on a
  30. // template dependent value where the type is concrete but determined through
  31. // the template dependent value.
  32. fn F(template c:! C) -> i32 {
  33. // CHECK:STDERR: fail_todo_unimplemented_value.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.MulWith(Core.IntLiteral)` in type `<dependent type>` that does not implement that interface [MissingImplInMemberAccess]
  34. // CHECK:STDERR: return c.n * 3;
  35. // CHECK:STDERR: ^~~~~~~
  36. // CHECK:STDERR:
  37. return c.n * 3;
  38. }
  39. // --- fail_todo_unimplemented_convert.carbon
  40. library "[[@TEST_NAME]]";
  41. fn F[template T:! type](x: T) {
  42. // TODO: These diagnostics aren't very good, and we should only produce one error here.
  43. // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+8]]:3: error: member name of type `<dependent type>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
  44. // CHECK:STDERR: var v: T = 0;
  45. // CHECK:STDERR: ^~~~~~~~
  46. // CHECK:STDERR:
  47. // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+4]]:3: error: value of type `<dependent type>` is not callable [CallToNonCallable]
  48. // CHECK:STDERR: var v: T = 0;
  49. // CHECK:STDERR: ^~~~~~~~
  50. // CHECK:STDERR:
  51. var v: T = 0;
  52. // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `T` to `i32` [ConversionFailure]
  53. // CHECK:STDERR: var w: i32 = x;
  54. // CHECK:STDERR: ^~~~~~~~~~
  55. // CHECK:STDERR: fail_todo_unimplemented_convert.carbon:[[@LINE+4]]:3: note: type `T` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  56. // CHECK:STDERR: var w: i32 = x;
  57. // CHECK:STDERR: ^~~~~~~~~~
  58. // CHECK:STDERR:
  59. var w: i32 = x;
  60. }
  61. // CHECK:STDOUT: --- fail_todo_unimplemented_operator.carbon
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: constants {
  64. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0, template [template]
  65. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  66. // CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %T [template]
  67. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  68. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  69. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  70. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  71. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  72. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  73. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  74. // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [template]
  75. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  76. // CHECK:STDOUT: %MulWith.type.8b4: type = generic_interface_type @MulWith [concrete]
  77. // CHECK:STDOUT: %MulWith.generic: %MulWith.type.8b4 = struct_value () [concrete]
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: imports {
  81. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  82. // CHECK:STDOUT: .Int = %Core.Int
  83. // CHECK:STDOUT: .MulWith = %Core.MulWith
  84. // CHECK:STDOUT: import Core//prelude
  85. // CHECK:STDOUT: import Core//prelude/...
  86. // CHECK:STDOUT: }
  87. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  88. // CHECK:STDOUT: %Core.MulWith: %MulWith.type.8b4 = import_ref Core//prelude/operators/arithmetic, MulWith, loaded [concrete = constants.%MulWith.generic]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: file {
  92. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  93. // CHECK:STDOUT: .Core = imports.%Core
  94. // CHECK:STDOUT: .F = %F.decl
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: %Core.import = import Core
  97. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  98. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete]
  99. // CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  100. // CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param0 [concrete]
  101. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  102. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  103. // CHECK:STDOUT: } {
  104. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  105. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  106. // CHECK:STDOUT: %T.loc6_15.1: type = bind_symbolic_name T, 0, template [template = %T.loc6_15.2 (constants.%T)]
  107. // CHECK:STDOUT: %x.param: @F.%T.loc6_15.2 (%T) = value_param call_param0
  108. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_15.1 [template = %T.loc6_15.2 (constants.%T)]
  109. // CHECK:STDOUT: %x: @F.%T.loc6_15.2 (%T) = bind_name x, %x.param
  110. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  111. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: generic fn @F(%T.loc6_15.1: type) {
  116. // CHECK:STDOUT: %T.loc6_15.2: type = bind_symbolic_name T, 0, template [template = %T.loc6_15.2 (constants.%T)]
  117. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc6_15.2 [template = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: !definition:
  120. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.loc6_15.2 [template = %require_complete (constants.%require_complete.4ae)]
  121. // CHECK:STDOUT: %.loc11_11.3: <instruction> = refine_type_action %x.ref, %T.loc6_15.2 [template]
  122. // CHECK:STDOUT: %.loc11_11.4: <instruction> = access_member_action %.loc11_11.1, n [template]
  123. // CHECK:STDOUT: %.loc11_11.5: type = type_of_inst %.loc11_11.4 [template]
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: fn(%x.param: @F.%T.loc6_15.2 (%T)) -> %i32 {
  126. // CHECK:STDOUT: !entry:
  127. // CHECK:STDOUT: %x.ref: @F.%T.loc6_15.2 (%T) = name_ref x, %x
  128. // CHECK:STDOUT: %.loc11_11.1: @F.%T.loc6_15.2 (%T) = splice_inst %.loc11_11.3
  129. // CHECK:STDOUT: %.loc11_11.2: @F.%.loc11_11.5 (@F.%.loc11_11.5) = splice_inst %.loc11_11.4
  130. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  131. // CHECK:STDOUT: return <error>
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: specific @F(constants.%T) {
  136. // CHECK:STDOUT: %T.loc6_15.2 => constants.%T
  137. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: --- fail_todo_unimplemented_value.carbon
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: constants {
  143. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  144. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  145. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  146. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  147. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  148. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [concrete]
  149. // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %i32} [concrete]
  150. // CHECK:STDOUT: %complete_type.54b: <witness> = complete_type_witness %struct_type.n [concrete]
  151. // CHECK:STDOUT: %c: %C = bind_symbolic_name c, 0, template [template]
  152. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  153. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  154. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  155. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  156. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  157. // CHECK:STDOUT: %MulWith.type.8b4: type = generic_interface_type @MulWith [concrete]
  158. // CHECK:STDOUT: %MulWith.generic: %MulWith.type.8b4 = struct_value () [concrete]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: imports {
  162. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  163. // CHECK:STDOUT: .Int = %Core.Int
  164. // CHECK:STDOUT: .MulWith = %Core.MulWith
  165. // CHECK:STDOUT: import Core//prelude
  166. // CHECK:STDOUT: import Core//prelude/...
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  169. // CHECK:STDOUT: %Core.MulWith: %MulWith.type.8b4 = import_ref Core//prelude/operators/arithmetic, MulWith, loaded [concrete = constants.%MulWith.generic]
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: file {
  173. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  174. // CHECK:STDOUT: .Core = imports.%Core
  175. // CHECK:STDOUT: .C = %C.decl
  176. // CHECK:STDOUT: .F = %F.decl
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT: %Core.import = import Core
  179. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  180. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  181. // CHECK:STDOUT: %c.patt: %pattern_type.c48 = symbolic_binding_pattern c, 0, template [concrete]
  182. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  183. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param0 [concrete]
  184. // CHECK:STDOUT: } {
  185. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  186. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  187. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  188. // CHECK:STDOUT: %c.loc11_15.1: %C = bind_symbolic_name c, 0, template [template = %c.loc11_15.2 (constants.%c)]
  189. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
  190. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: class @C {
  195. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  196. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  197. // CHECK:STDOUT: %.loc5: %C.elem = field_decl n, element0 [concrete]
  198. // CHECK:STDOUT: %struct_type.n: type = struct_type {.n: %i32} [concrete = constants.%struct_type.n]
  199. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.n [concrete = constants.%complete_type.54b]
  200. // CHECK:STDOUT: complete_type_witness = %complete_type
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: !members:
  203. // CHECK:STDOUT: .Self = constants.%C
  204. // CHECK:STDOUT: .n = %.loc5
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: generic fn @F(%c.loc11_15.1: %C) {
  208. // CHECK:STDOUT: %c.loc11_15.2: %C = bind_symbolic_name c, 0, template [template = %c.loc11_15.2 (constants.%c)]
  209. // CHECK:STDOUT:
  210. // CHECK:STDOUT: !definition:
  211. // CHECK:STDOUT: %.loc16_11.2: <instruction> = access_member_action %c.ref, n [template]
  212. // CHECK:STDOUT: %.loc16_11.3: type = type_of_inst %.loc16_11.2 [template]
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: fn() -> %i32 {
  215. // CHECK:STDOUT: !entry:
  216. // CHECK:STDOUT: %c.ref: %C = name_ref c, %c.loc11_15.1 [template = %c.loc11_15.2 (constants.%c)]
  217. // CHECK:STDOUT: %.loc16_11.1: @F.%.loc16_11.3 (@F.%.loc16_11.3) = splice_inst %.loc16_11.2
  218. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  219. // CHECK:STDOUT: return <error>
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: specific @F(constants.%c) {
  224. // CHECK:STDOUT: %c.loc11_15.2 => constants.%c
  225. // CHECK:STDOUT: }
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: --- fail_todo_unimplemented_convert.carbon
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: constants {
  230. // CHECK:STDOUT: %T.8b3d5d.1: type = bind_symbolic_name T, 0, template [template]
  231. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  232. // CHECK:STDOUT: %pattern_type.7dcd0a.1: type = pattern_type %T.8b3d5d.1 [template]
  233. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  234. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  235. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  236. // CHECK:STDOUT: %require_complete.4aeca8.1: <witness> = require_complete_type %T.8b3d5d.1 [template]
  237. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  238. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  239. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  240. // CHECK:STDOUT: %ImplicitAs.type.d628ce.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T.8b3d5d.1)> [template]
  241. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  242. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  243. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  244. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  245. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  246. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  247. // CHECK:STDOUT: %Op.type.bae: type = fn_type @Op.95 [concrete]
  248. // CHECK:STDOUT: %Op.type.a17: type = fn_type @Op.96, @Destroy.impl(%i32) [concrete]
  249. // CHECK:STDOUT: %Op.e6a: %Op.type.a17 = struct_value () [concrete]
  250. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  251. // CHECK:STDOUT: %Op.specific_fn.014: <specific function> = specific_function %Op.e6a, @Op.96(%i32) [concrete]
  252. // CHECK:STDOUT: %ptr.79f131.2: type = ptr_type %T.8b3d5d.1 [template]
  253. // CHECK:STDOUT: %require_complete.6e5e64.2: <witness> = require_complete_type %ptr.79f131.2 [template]
  254. // CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %T.8b3d5d.1, @Destroy [template]
  255. // CHECK:STDOUT: %Destroy.facet.713: %Destroy.type = facet_value %T.8b3d5d.1, (%Destroy.lookup_impl_witness) [template]
  256. // CHECK:STDOUT: %.a63: type = fn_type_with_self_type %Op.type.bae, %Destroy.facet.713 [template]
  257. // CHECK:STDOUT: %impl.elem0.538: %.a63 = impl_witness_access %Destroy.lookup_impl_witness, element0 [template]
  258. // CHECK:STDOUT: %specific_impl_fn.1af: <specific function> = specific_impl_function %impl.elem0.538, @Op.95(%Destroy.facet.713) [template]
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: imports {
  262. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  263. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  264. // CHECK:STDOUT: .Int = %Core.Int
  265. // CHECK:STDOUT: .Destroy = %Core.Destroy
  266. // CHECK:STDOUT: import Core//prelude
  267. // CHECK:STDOUT: import Core//prelude/...
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  270. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  271. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: file {
  275. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  276. // CHECK:STDOUT: .Core = imports.%Core
  277. // CHECK:STDOUT: .F = %F.decl
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT: %Core.import = import Core
  280. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  281. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0, template [concrete]
  282. // CHECK:STDOUT: %x.patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern x [concrete]
  283. // CHECK:STDOUT: %x.param_patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = value_param_pattern %x.patt, call_param0 [concrete]
  284. // CHECK:STDOUT: } {
  285. // CHECK:STDOUT: %T.loc4_15.1: type = bind_symbolic_name T, 0, template [template = %T.loc4_15.2 (constants.%T.8b3d5d.1)]
  286. // CHECK:STDOUT: %x.param: @F.%T.loc4_15.2 (%T.8b3d5d.1) = value_param call_param0
  287. // CHECK:STDOUT: %T.ref.loc4: type = name_ref T, %T.loc4_15.1 [template = %T.loc4_15.2 (constants.%T.8b3d5d.1)]
  288. // CHECK:STDOUT: %x: @F.%T.loc4_15.2 (%T.8b3d5d.1) = bind_name x, %x.param
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: generic fn @F(%T.loc4_15.1: type) {
  293. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T, 0, template [template = %T.loc4_15.2 (constants.%T.8b3d5d.1)]
  294. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc4_15.2 [template = %pattern_type (constants.%pattern_type.7dcd0a.1)]
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: !definition:
  297. // CHECK:STDOUT: %require_complete.loc4: <witness> = require_complete_type %T.loc4_15.2 [template = %require_complete.loc4 (constants.%require_complete.4aeca8.1)]
  298. // CHECK:STDOUT: %ImplicitAs.type.loc14_3.2: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc4_15.2)> [template = %ImplicitAs.type.loc14_3.2 (constants.%ImplicitAs.type.d628ce.2)]
  299. // CHECK:STDOUT: %.loc14_3.4: <instruction> = access_member_action %ImplicitAs.type.loc14_3.1, Convert [template]
  300. // CHECK:STDOUT: %.loc14_3.5: type = type_of_inst %.loc14_3.4 [template]
  301. // CHECK:STDOUT: %Destroy.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc4_15.2, @Destroy [template = %Destroy.lookup_impl_witness (constants.%Destroy.lookup_impl_witness)]
  302. // CHECK:STDOUT: %Destroy.facet: %Destroy.type = facet_value %T.loc4_15.2, (%Destroy.lookup_impl_witness) [template = %Destroy.facet (constants.%Destroy.facet.713)]
  303. // CHECK:STDOUT: %.loc14_3.6: type = fn_type_with_self_type constants.%Op.type.bae, %Destroy.facet [template = %.loc14_3.6 (constants.%.a63)]
  304. // CHECK:STDOUT: %impl.elem0.loc14_3.2: @F.%.loc14_3.6 (%.a63) = impl_witness_access %Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc14_3.2 (constants.%impl.elem0.538)]
  305. // CHECK:STDOUT: %specific_impl_fn.loc14_3.2: <specific function> = specific_impl_function %impl.elem0.loc14_3.2, @Op.95(%Destroy.facet) [template = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.1af)]
  306. // CHECK:STDOUT: %ptr: type = ptr_type %T.loc4_15.2 [template = %ptr (constants.%ptr.79f131.2)]
  307. // CHECK:STDOUT: %require_complete.loc14: <witness> = require_complete_type %ptr [template = %require_complete.loc14 (constants.%require_complete.6e5e64.2)]
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: fn(%x.param: @F.%T.loc4_15.2 (%T.8b3d5d.1)) {
  310. // CHECK:STDOUT: !entry:
  311. // CHECK:STDOUT: name_binding_decl {
  312. // CHECK:STDOUT: %v.patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = binding_pattern v [concrete]
  313. // CHECK:STDOUT: %v.var_patt: @F.%pattern_type (%pattern_type.7dcd0a.1) = var_pattern %v.patt [concrete]
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT: %v.var: ref @F.%T.loc4_15.2 (%T.8b3d5d.1) = var %v.var_patt
  316. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  317. // CHECK:STDOUT: %ImplicitAs.type.loc14_3.1: type = facet_type <@ImplicitAs, @ImplicitAs(constants.%T.8b3d5d.1)> [template = %ImplicitAs.type.loc14_3.2 (constants.%ImplicitAs.type.d628ce.2)]
  318. // CHECK:STDOUT: %.loc14_3.1: @F.%.loc14_3.5 (@F.%.loc14_3.5) = splice_inst %.loc14_3.4
  319. // CHECK:STDOUT: %.loc14_3.2: @F.%T.loc4_15.2 (%T.8b3d5d.1) = converted %int_0, <error> [concrete = <error>]
  320. // CHECK:STDOUT: assign %v.var, <error>
  321. // CHECK:STDOUT: %T.ref.loc14: type = name_ref T, %T.loc4_15.1 [template = %T.loc4_15.2 (constants.%T.8b3d5d.1)]
  322. // CHECK:STDOUT: %v: ref @F.%T.loc4_15.2 (%T.8b3d5d.1) = bind_name v, %v.var
  323. // CHECK:STDOUT: name_binding_decl {
  324. // CHECK:STDOUT: %w.patt: %pattern_type.7ce = binding_pattern w [concrete]
  325. // CHECK:STDOUT: %w.var_patt: %pattern_type.7ce = var_pattern %w.patt [concrete]
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT: %w.var: ref %i32 = var %w.var_patt
  328. // CHECK:STDOUT: %x.ref: @F.%T.loc4_15.2 (%T.8b3d5d.1) = name_ref x, %x
  329. // CHECK:STDOUT: %.loc22_3: %i32 = converted %x.ref, <error> [concrete = <error>]
  330. // CHECK:STDOUT: assign %w.var, <error>
  331. // CHECK:STDOUT: %.loc22_10: type = splice_block %i32 [concrete = constants.%i32] {
  332. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  333. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT: %w: ref %i32 = bind_name w, %w.var
  336. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %w.var, constants.%Op.e6a
  337. // CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function constants.%Op.e6a, @Op.96(constants.%i32) [concrete = constants.%Op.specific_fn.014]
  338. // CHECK:STDOUT: %bound_method.loc22: <bound method> = bound_method %w.var, %Op.specific_fn
  339. // CHECK:STDOUT: %addr.loc22: %ptr.235 = addr_of %w.var
  340. // CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc22(%addr.loc22)
  341. // CHECK:STDOUT: %impl.elem0.loc14_3.1: @F.%.loc14_3.6 (%.a63) = impl_witness_access constants.%Destroy.lookup_impl_witness, element0 [template = %impl.elem0.loc14_3.2 (constants.%impl.elem0.538)]
  342. // CHECK:STDOUT: %bound_method.loc14_3.1: <bound method> = bound_method %v.var, %impl.elem0.loc14_3.1
  343. // CHECK:STDOUT: %specific_impl_fn.loc14_3.1: <specific function> = specific_impl_function %impl.elem0.loc14_3.1, @Op.95(constants.%Destroy.facet.713) [template = %specific_impl_fn.loc14_3.2 (constants.%specific_impl_fn.1af)]
  344. // CHECK:STDOUT: %bound_method.loc14_3.2: <bound method> = bound_method %v.var, %specific_impl_fn.loc14_3.1
  345. // CHECK:STDOUT: %addr.loc14: @F.%ptr (%ptr.79f131.2) = addr_of %v.var
  346. // CHECK:STDOUT: %.loc14_3.3: init %empty_tuple.type = call %bound_method.loc14_3.2(%addr.loc14)
  347. // CHECK:STDOUT: return
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: specific @F(constants.%T.8b3d5d.1) {
  352. // CHECK:STDOUT: %T.loc4_15.2 => constants.%T.8b3d5d.1
  353. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dcd0a.1
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: