undefined.carbon 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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/function/generic/undefined.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/undefined.carbon
  10. // --- call_defined.carbon
  11. library "[[@TEST_NAME]]";
  12. fn Defined[T:! type](x: T) -> T {
  13. return x;
  14. }
  15. fn CallDefined() -> i32 {
  16. return Defined(0);
  17. }
  18. // --- call_defined_late.carbon
  19. library "[[@TEST_NAME]]";
  20. fn Defined[T:! type](x: T) -> T;
  21. fn CallDefined() -> i32 {
  22. return Defined(0);
  23. }
  24. fn Defined[T:! type](x: T) -> T {
  25. return x;
  26. }
  27. // --- fail_call_undefined.carbon
  28. library "[[@TEST_NAME]]";
  29. fn Undefined[T:! type](x: T) -> T;
  30. fn CallUndefined() -> i32 {
  31. // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE+6]]:10: error: use of undefined generic function
  32. // CHECK:STDERR: return Undefined(0);
  33. // CHECK:STDERR: ^~~~~~~~~
  34. // CHECK:STDERR: fail_call_undefined.carbon:[[@LINE-6]]:1: note: generic function declared here
  35. // CHECK:STDERR: fn Undefined[T:! type](x: T) -> T;
  36. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. return Undefined(0);
  38. }
  39. // CHECK:STDOUT: --- call_defined.carbon
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: constants {
  42. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  43. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  44. // CHECK:STDOUT: %Defined.type: type = fn_type @Defined [template]
  45. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  46. // CHECK:STDOUT: %Defined: %Defined.type = struct_value () [template]
  47. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  48. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  49. // CHECK:STDOUT: %CallDefined.type: type = fn_type @CallDefined [template]
  50. // CHECK:STDOUT: %CallDefined: %CallDefined.type = struct_value () [template]
  51. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  52. // CHECK:STDOUT: %.3: <specific function> = specific_function %Defined, @Defined(i32) [template]
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: imports {
  56. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  57. // CHECK:STDOUT: .Int32 = %import_ref
  58. // CHECK:STDOUT: import Core//prelude
  59. // CHECK:STDOUT: import Core//prelude/operators
  60. // CHECK:STDOUT: import Core//prelude/types
  61. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  62. // CHECK:STDOUT: import Core//prelude/operators/as
  63. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  64. // CHECK:STDOUT: import Core//prelude/operators/comparison
  65. // CHECK:STDOUT: import Core//prelude/types/bool
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: file {
  71. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  72. // CHECK:STDOUT: .Core = imports.%Core
  73. // CHECK:STDOUT: .Defined = %Defined.decl
  74. // CHECK:STDOUT: .CallDefined = %CallDefined.decl
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: %Core.import = import Core
  77. // CHECK:STDOUT: %Defined.decl: %Defined.type = fn_decl @Defined [template = constants.%Defined] {
  78. // CHECK:STDOUT: %T.patt.loc4_12.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_12.2 (constants.%T.patt)]
  79. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4_12.1, runtime_param<invalid> [symbolic = %T.patt.loc4_12.2 (constants.%T.patt)]
  80. // CHECK:STDOUT: %x.patt: @Defined.%T.loc4_12.2 (%T) = binding_pattern x
  81. // CHECK:STDOUT: %x.param_patt: @Defined.%T.loc4_12.2 (%T) = param_pattern %x.patt, runtime_param0
  82. // CHECK:STDOUT: } {
  83. // CHECK:STDOUT: %T.ref.loc4_25: type = name_ref T, %T.loc4_12.1 [symbolic = %T.loc4_12.2 (constants.%T)]
  84. // CHECK:STDOUT: %T.ref.loc4_31: type = name_ref T, %T.loc4_12.1 [symbolic = %T.loc4_12.2 (constants.%T)]
  85. // CHECK:STDOUT: %return: ref @Defined.%T.loc4_12.2 (%T) = var <return slot>
  86. // CHECK:STDOUT: %param.loc4_12: type = param runtime_param<invalid>
  87. // CHECK:STDOUT: %T.loc4_12.1: type = bind_symbolic_name T, 0, %param.loc4_12 [symbolic = %T.loc4_12.2 (constants.%T)]
  88. // CHECK:STDOUT: %param.loc4_22: @Defined.%T.loc4_12.2 (%T) = param runtime_param0
  89. // CHECK:STDOUT: %x: @Defined.%T.loc4_12.2 (%T) = bind_name x, %param.loc4_22
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %CallDefined.decl: %CallDefined.type = fn_decl @CallDefined [template = constants.%CallDefined] {} {
  92. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  93. // CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  94. // CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32, %.loc8_21.1 [template = i32]
  95. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: generic fn @Defined(%T.loc4_12.1: type) {
  100. // CHECK:STDOUT: %T.loc4_12.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_12.2 (constants.%T)]
  101. // CHECK:STDOUT: %T.patt.loc4_12.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_12.2 (constants.%T.patt)]
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: !definition:
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @Defined.%T.loc4_12.2 (%T)) -> @Defined.%T.loc4_12.2 (%T) {
  106. // CHECK:STDOUT: !entry:
  107. // CHECK:STDOUT: %x.ref: @Defined.%T.loc4_12.2 (%T) = name_ref x, %x
  108. // CHECK:STDOUT: return %x.ref
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: fn @CallDefined() -> i32 {
  115. // CHECK:STDOUT: !entry:
  116. // CHECK:STDOUT: %Defined.ref: %Defined.type = name_ref Defined, file.%Defined.decl [template = constants.%Defined]
  117. // CHECK:STDOUT: %.loc9_18: i32 = int_literal 0 [template = constants.%.2]
  118. // CHECK:STDOUT: %.loc9_10: <specific function> = specific_function %Defined.ref, @Defined(i32) [template = constants.%.3]
  119. // CHECK:STDOUT: %Defined.call: init i32 = call %.loc9_10(%.loc9_18)
  120. // CHECK:STDOUT: %.loc9_20.1: i32 = value_of_initializer %Defined.call
  121. // CHECK:STDOUT: %.loc9_20.2: i32 = converted %Defined.call, %.loc9_20.1
  122. // CHECK:STDOUT: return %.loc9_20.2
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: specific @Defined(constants.%T) {
  126. // CHECK:STDOUT: %T.loc4_12.2 => constants.%T
  127. // CHECK:STDOUT: %T.patt.loc4_12.2 => constants.%T
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: specific @Defined(i32) {
  131. // CHECK:STDOUT: %T.loc4_12.2 => i32
  132. // CHECK:STDOUT: %T.patt.loc4_12.2 => i32
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: !definition:
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: --- call_defined_late.carbon
  138. // CHECK:STDOUT:
  139. // CHECK:STDOUT: constants {
  140. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  141. // CHECK:STDOUT: %T.patt.1: type = symbolic_binding_pattern T, 0 [symbolic]
  142. // CHECK:STDOUT: %Defined.type: type = fn_type @Defined [template]
  143. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  144. // CHECK:STDOUT: %Defined: %Defined.type = struct_value () [template]
  145. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  146. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  147. // CHECK:STDOUT: %CallDefined.type: type = fn_type @CallDefined [template]
  148. // CHECK:STDOUT: %CallDefined: %CallDefined.type = struct_value () [template]
  149. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  150. // CHECK:STDOUT: %.3: <specific function> = specific_function %Defined, @Defined(i32) [template]
  151. // CHECK:STDOUT: %T.patt.2: type = symbolic_binding_pattern T, 0 [symbolic]
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: imports {
  155. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  156. // CHECK:STDOUT: .Int32 = %import_ref
  157. // CHECK:STDOUT: import Core//prelude
  158. // CHECK:STDOUT: import Core//prelude/operators
  159. // CHECK:STDOUT: import Core//prelude/types
  160. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  161. // CHECK:STDOUT: import Core//prelude/operators/as
  162. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  163. // CHECK:STDOUT: import Core//prelude/operators/comparison
  164. // CHECK:STDOUT: import Core//prelude/types/bool
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: file {
  170. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  171. // CHECK:STDOUT: .Core = imports.%Core
  172. // CHECK:STDOUT: .Defined = %Defined.decl.loc4
  173. // CHECK:STDOUT: .CallDefined = %CallDefined.decl
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: %Core.import = import Core
  176. // CHECK:STDOUT: %Defined.decl.loc4: %Defined.type = fn_decl @Defined [template = constants.%Defined] {
  177. // CHECK:STDOUT: %T.patt.loc10: type = symbolic_binding_pattern T, 0 [symbolic = constants.%T.patt.2]
  178. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc10, runtime_param<invalid> [symbolic = constants.%T.patt.2]
  179. // CHECK:STDOUT: %x.patt: %T = binding_pattern x
  180. // CHECK:STDOUT: %x.param_patt: %T = param_pattern %x.patt, runtime_param0
  181. // CHECK:STDOUT: } {
  182. // CHECK:STDOUT: %T.ref.loc4_25: type = name_ref T, %T.loc4_12.1 [symbolic = %T.loc4_12.2 (constants.%T)]
  183. // CHECK:STDOUT: %T.ref.loc4_31: type = name_ref T, %T.loc4_12.1 [symbolic = %T.loc4_12.2 (constants.%T)]
  184. // CHECK:STDOUT: %return.var.loc4: ref @Defined.%T.loc4_12.2 (%T) = var <return slot>
  185. // CHECK:STDOUT: %param.loc4_12: type = param runtime_param<invalid>
  186. // CHECK:STDOUT: %T.loc4_12.1: type = bind_symbolic_name T, 0, %param.loc4_12 [symbolic = %T.loc4_12.2 (constants.%T)]
  187. // CHECK:STDOUT: %param.loc4_22: @Defined.%T.loc4_12.2 (%T) = param runtime_param0
  188. // CHECK:STDOUT: %x.loc4: @Defined.%T.loc4_12.2 (%T) = bind_name x, %param.loc4_22
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT: %CallDefined.decl: %CallDefined.type = fn_decl @CallDefined [template = constants.%CallDefined] {} {
  191. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  192. // CHECK:STDOUT: %.loc6_21.1: type = value_of_initializer %int.make_type_32 [template = i32]
  193. // CHECK:STDOUT: %.loc6_21.2: type = converted %int.make_type_32, %.loc6_21.1 [template = i32]
  194. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT: %Defined.decl.loc10: %Defined.type = fn_decl @Defined [template = constants.%Defined] {
  197. // CHECK:STDOUT: %T.patt.loc10: type = symbolic_binding_pattern T, 0 [symbolic = constants.%T.patt.2]
  198. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc10, runtime_param<invalid> [symbolic = constants.%T.patt.2]
  199. // CHECK:STDOUT: %x.patt: %T = binding_pattern x
  200. // CHECK:STDOUT: %x.param_patt: %T = param_pattern %x.patt, runtime_param0
  201. // CHECK:STDOUT: } {
  202. // CHECK:STDOUT: %T.ref.loc10_25: type = name_ref T, %T.loc10 [symbolic = constants.%T]
  203. // CHECK:STDOUT: %T.ref.loc10_31: type = name_ref T, %T.loc10 [symbolic = constants.%T]
  204. // CHECK:STDOUT: %return: ref %T = var <return slot>
  205. // CHECK:STDOUT: %param.loc10_12: type = param runtime_param<invalid>
  206. // CHECK:STDOUT: %T.loc10: type = bind_symbolic_name T, 0, %param.loc10_12 [symbolic = constants.%T]
  207. // CHECK:STDOUT: %param.loc10_22: %T = param runtime_param0
  208. // CHECK:STDOUT: %x.loc10: %T = bind_name x, %param.loc10_22
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: generic fn @Defined(%T.loc4_12.1: type) {
  213. // CHECK:STDOUT: %T.loc4_12.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_12.2 (constants.%T)]
  214. // CHECK:STDOUT: %T.patt.loc4: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4 (constants.%T.patt.1)]
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: !definition:
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: %T) -> %T {
  219. // CHECK:STDOUT: !entry:
  220. // CHECK:STDOUT: %x.ref: @Defined.%T.loc4_12.2 (%T) = name_ref x, %x.loc10
  221. // CHECK:STDOUT: return %x.ref
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: fn @CallDefined() -> i32 {
  228. // CHECK:STDOUT: !entry:
  229. // CHECK:STDOUT: %Defined.ref: %Defined.type = name_ref Defined, file.%Defined.decl.loc4 [template = constants.%Defined]
  230. // CHECK:STDOUT: %.loc7_18: i32 = int_literal 0 [template = constants.%.2]
  231. // CHECK:STDOUT: %.loc7_10: <specific function> = specific_function %Defined.ref, @Defined(i32) [template = constants.%.3]
  232. // CHECK:STDOUT: %Defined.call: init i32 = call %.loc7_10(%.loc7_18)
  233. // CHECK:STDOUT: %.loc7_20.1: i32 = value_of_initializer %Defined.call
  234. // CHECK:STDOUT: %.loc7_20.2: i32 = converted %Defined.call, %.loc7_20.1
  235. // CHECK:STDOUT: return %.loc7_20.2
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: specific @Defined(constants.%T) {
  239. // CHECK:STDOUT: %T.loc4_12.2 => constants.%T
  240. // CHECK:STDOUT: %T.patt.loc4 => constants.%T
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: specific @Defined(i32) {
  244. // CHECK:STDOUT: %T.loc4_12.2 => i32
  245. // CHECK:STDOUT: %T.patt.loc4 => i32
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: !definition:
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: --- fail_call_undefined.carbon
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: constants {
  253. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  254. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  255. // CHECK:STDOUT: %Undefined.type: type = fn_type @Undefined [template]
  256. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  257. // CHECK:STDOUT: %Undefined: %Undefined.type = struct_value () [template]
  258. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  259. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  260. // CHECK:STDOUT: %CallUndefined.type: type = fn_type @CallUndefined [template]
  261. // CHECK:STDOUT: %CallUndefined: %CallUndefined.type = struct_value () [template]
  262. // CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
  263. // CHECK:STDOUT: %.3: <specific function> = specific_function %Undefined, @Undefined(i32) [template]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: imports {
  267. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  268. // CHECK:STDOUT: .Int32 = %import_ref
  269. // CHECK:STDOUT: import Core//prelude
  270. // CHECK:STDOUT: import Core//prelude/operators
  271. // CHECK:STDOUT: import Core//prelude/types
  272. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  273. // CHECK:STDOUT: import Core//prelude/operators/as
  274. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  275. // CHECK:STDOUT: import Core//prelude/operators/comparison
  276. // CHECK:STDOUT: import Core//prelude/types/bool
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+9, loaded [template = constants.%Int32]
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: file {
  282. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  283. // CHECK:STDOUT: .Core = imports.%Core
  284. // CHECK:STDOUT: .Undefined = %Undefined.decl
  285. // CHECK:STDOUT: .CallUndefined = %CallUndefined.decl
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: %Core.import = import Core
  288. // CHECK:STDOUT: %Undefined.decl: %Undefined.type = fn_decl @Undefined [template = constants.%Undefined] {
  289. // CHECK:STDOUT: %T.patt.loc4_14.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
  290. // CHECK:STDOUT: %T.param_patt: type = param_pattern %T.patt.loc4_14.1, runtime_param<invalid> [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
  291. // CHECK:STDOUT: %x.patt: @Undefined.%T.loc4_14.2 (%T) = binding_pattern x
  292. // CHECK:STDOUT: %x.param_patt: @Undefined.%T.loc4_14.2 (%T) = param_pattern %x.patt, runtime_param0
  293. // CHECK:STDOUT: } {
  294. // CHECK:STDOUT: %T.ref.loc4_27: type = name_ref T, %T.loc4_14.1 [symbolic = %T.loc4_14.2 (constants.%T)]
  295. // CHECK:STDOUT: %T.ref.loc4_33: type = name_ref T, %T.loc4_14.1 [symbolic = %T.loc4_14.2 (constants.%T)]
  296. // CHECK:STDOUT: %return: ref @Undefined.%T.loc4_14.2 (%T) = var <return slot>
  297. // CHECK:STDOUT: %param.loc4_14: type = param runtime_param<invalid>
  298. // CHECK:STDOUT: %T.loc4_14.1: type = bind_symbolic_name T, 0, %param.loc4_14 [symbolic = %T.loc4_14.2 (constants.%T)]
  299. // CHECK:STDOUT: %param.loc4_24: @Undefined.%T.loc4_14.2 (%T) = param runtime_param0
  300. // CHECK:STDOUT: %x: @Undefined.%T.loc4_14.2 (%T) = bind_name x, %param.loc4_24
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: %CallUndefined.decl: %CallUndefined.type = fn_decl @CallUndefined [template = constants.%CallUndefined] {} {
  303. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  304. // CHECK:STDOUT: %.loc6_23.1: type = value_of_initializer %int.make_type_32 [template = i32]
  305. // CHECK:STDOUT: %.loc6_23.2: type = converted %int.make_type_32, %.loc6_23.1 [template = i32]
  306. // CHECK:STDOUT: %return: ref i32 = var <return slot>
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: generic fn @Undefined(%T.loc4_14.1: type) {
  311. // CHECK:STDOUT: %T.loc4_14.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_14.2 (constants.%T)]
  312. // CHECK:STDOUT: %T.patt.loc4_14.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_14.2 (constants.%T.patt)]
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @Undefined.%T.loc4_14.2 (%T)) -> @Undefined.%T.loc4_14.2 (%T);
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: fn @CallUndefined() -> i32 {
  320. // CHECK:STDOUT: !entry:
  321. // CHECK:STDOUT: %Undefined.ref: %Undefined.type = name_ref Undefined, file.%Undefined.decl [template = constants.%Undefined]
  322. // CHECK:STDOUT: %.loc13_20: i32 = int_literal 0 [template = constants.%.2]
  323. // CHECK:STDOUT: %.loc13_10: <specific function> = specific_function %Undefined.ref, @Undefined(i32) [template = constants.%.3]
  324. // CHECK:STDOUT: %Undefined.call: init i32 = call %.loc13_10(%.loc13_20)
  325. // CHECK:STDOUT: %.loc13_22.1: i32 = value_of_initializer %Undefined.call
  326. // CHECK:STDOUT: %.loc13_22.2: i32 = converted %Undefined.call, %.loc13_22.1
  327. // CHECK:STDOUT: return %.loc13_22.2
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: specific @Undefined(constants.%T) {
  331. // CHECK:STDOUT: %T.loc4_14.2 => constants.%T
  332. // CHECK:STDOUT: %T.patt.loc4_14.2 => constants.%T
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: specific @Undefined(i32) {
  336. // CHECK:STDOUT: %T.loc4_14.2 => i32
  337. // CHECK:STDOUT: %T.patt.loc4_14.2 => i32
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: