underscore.carbon 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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. // This is mostly checking against crashes for compile time bindings in
  6. // difficult contexts.
  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/patterns/no_prelude/underscore.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/patterns/no_prelude/underscore.carbon
  13. // --- basic.carbon
  14. library "[[@TEST_NAME]]";
  15. let _: {} = {};
  16. var _: {} = {};
  17. fn F() {
  18. let _: {} = {};
  19. var _: {} = {};
  20. }
  21. // --- function.carbon
  22. library "[[@TEST_NAME]]";
  23. fn F(_: {});
  24. fn G(_: {}) {}
  25. fn H() {
  26. F({});
  27. }
  28. // --- function_generic.carbon
  29. library "[[@TEST_NAME]]";
  30. fn F(_:! type) {};
  31. fn G() {
  32. F({});
  33. }
  34. // --- fail_function_generic_undefined.carbon
  35. library "[[@TEST_NAME]]";
  36. fn F(_:! type);
  37. fn G() {
  38. // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE+7]]:3: error: use of undefined generic function [MissingGenericFunctionDefinition]
  39. // CHECK:STDERR: F({});
  40. // CHECK:STDERR: ^
  41. // CHECK:STDERR: fail_function_generic_undefined.carbon:[[@LINE-6]]:1: note: generic function declared here [MissingGenericFunctionDefinitionHere]
  42. // CHECK:STDERR: fn F(_:! type);
  43. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  44. // CHECK:STDERR:
  45. F({});
  46. }
  47. // --- function_implict.carbon
  48. library "[[@TEST_NAME]]";
  49. fn F[_:! type]();
  50. fn G[_:! type]() {}
  51. // --- fail_class.carbon
  52. library "[[@TEST_NAME]]";
  53. class C {
  54. // CHECK:STDERR: fail_class.carbon:[[@LINE+8]]:7: error: expected identifier in field declaration [ExpectedFieldIdentifier]
  55. // CHECK:STDERR: var _: ();
  56. // CHECK:STDERR: ^
  57. // CHECK:STDERR:
  58. // CHECK:STDERR: fail_class.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  59. // CHECK:STDERR: var _: ();
  60. // CHECK:STDERR: ^~~~~~~~~~
  61. // CHECK:STDERR:
  62. var _: ();
  63. }
  64. // --- fail_interface.carbon
  65. library "[[@TEST_NAME]]";
  66. interface I {
  67. // CHECK:STDERR: fail_interface.carbon:[[@LINE+4]]:7: error: semantics TODO: `_ used as associated constant name` [SemanticsTodo]
  68. // CHECK:STDERR: let _:! {};
  69. // CHECK:STDERR: ^~~~~~
  70. // CHECK:STDERR:
  71. let _:! {};
  72. }
  73. // --- fail_use.carbon
  74. fn F() -> {} {
  75. let _: {} = {};
  76. // CHECK:STDERR: fail_use.carbon:[[@LINE+12]]:10: error: expected expression [ExpectedExpr]
  77. // CHECK:STDERR: return _;
  78. // CHECK:STDERR: ^
  79. // CHECK:STDERR:
  80. // CHECK:STDERR: fail_use.carbon:[[@LINE+8]]:10: error: `return` statements must end with a `;` [ExpectedStatementSemi]
  81. // CHECK:STDERR: return _;
  82. // CHECK:STDERR: ^
  83. // CHECK:STDERR:
  84. // CHECK:STDERR: fail_use.carbon:[[@LINE+4]]:10: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  85. // CHECK:STDERR: return _;
  86. // CHECK:STDERR: ^
  87. // CHECK:STDERR:
  88. return _;
  89. }
  90. // CHECK:STDOUT: --- basic.carbon
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: constants {
  93. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  94. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  95. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  96. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: file {
  100. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  101. // CHECK:STDOUT: .F = %F.decl
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: name_binding_decl {
  104. // CHECK:STDOUT: %_.patt.loc4: %empty_struct_type = binding_pattern _
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: %.loc4_9.1: type = splice_block %.loc4_9.3 [concrete = constants.%empty_struct_type] {
  107. // CHECK:STDOUT: %.loc4_9.2: %empty_struct_type = struct_literal ()
  108. // CHECK:STDOUT: %.loc4_9.3: type = converted %.loc4_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  111. // CHECK:STDOUT: %.loc4_14: %empty_struct_type = converted @__global_init.%.loc4, %empty_struct [concrete = constants.%empty_struct]
  112. // CHECK:STDOUT: %_.loc4: %empty_struct_type = bind_name _, %.loc4_14
  113. // CHECK:STDOUT: name_binding_decl {
  114. // CHECK:STDOUT: %_.patt.loc5: %empty_struct_type = binding_pattern _
  115. // CHECK:STDOUT: %.loc5_1: %empty_struct_type = var_pattern %_.patt.loc5
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: %_.var: ref %empty_struct_type = var _
  118. // CHECK:STDOUT: %.loc5_9.1: type = splice_block %.loc5_9.3 [concrete = constants.%empty_struct_type] {
  119. // CHECK:STDOUT: %.loc5_9.2: %empty_struct_type = struct_literal ()
  120. // CHECK:STDOUT: %.loc5_9.3: type = converted %.loc5_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  121. // CHECK:STDOUT: }
  122. // CHECK:STDOUT: %_.loc5: ref %empty_struct_type = bind_name _, %_.var
  123. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: fn @F() {
  127. // CHECK:STDOUT: !entry:
  128. // CHECK:STDOUT: name_binding_decl {
  129. // CHECK:STDOUT: %_.patt.loc8: %empty_struct_type = binding_pattern _
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT: %.loc8_16.1: %empty_struct_type = struct_literal ()
  132. // CHECK:STDOUT: %.loc8_11.1: type = splice_block %.loc8_11.3 [concrete = constants.%empty_struct_type] {
  133. // CHECK:STDOUT: %.loc8_11.2: %empty_struct_type = struct_literal ()
  134. // CHECK:STDOUT: %.loc8_11.3: type = converted %.loc8_11.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  137. // CHECK:STDOUT: %.loc8_16.2: %empty_struct_type = converted %.loc8_16.1, %empty_struct [concrete = constants.%empty_struct]
  138. // CHECK:STDOUT: %_.loc8: %empty_struct_type = bind_name _, %.loc8_16.2
  139. // CHECK:STDOUT: name_binding_decl {
  140. // CHECK:STDOUT: %_.patt.loc9: %empty_struct_type = binding_pattern _
  141. // CHECK:STDOUT: %.loc9_3.1: %empty_struct_type = var_pattern %_.patt.loc9
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %_.var: ref %empty_struct_type = var _
  144. // CHECK:STDOUT: %.loc9_16.1: %empty_struct_type = struct_literal ()
  145. // CHECK:STDOUT: %.loc9_16.2: init %empty_struct_type = struct_init () to %_.var [concrete = constants.%empty_struct]
  146. // CHECK:STDOUT: %.loc9_3.2: init %empty_struct_type = converted %.loc9_16.1, %.loc9_16.2 [concrete = constants.%empty_struct]
  147. // CHECK:STDOUT: assign %_.var, %.loc9_3.2
  148. // CHECK:STDOUT: %.loc9_11.1: type = splice_block %.loc9_11.3 [concrete = constants.%empty_struct_type] {
  149. // CHECK:STDOUT: %.loc9_11.2: %empty_struct_type = struct_literal ()
  150. // CHECK:STDOUT: %.loc9_11.3: type = converted %.loc9_11.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT: %_.loc9: ref %empty_struct_type = bind_name _, %_.var
  153. // CHECK:STDOUT: return
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: fn @__global_init() {
  157. // CHECK:STDOUT: !entry:
  158. // CHECK:STDOUT: %.loc4: %empty_struct_type = struct_literal ()
  159. // CHECK:STDOUT: %.loc5_14.1: %empty_struct_type = struct_literal ()
  160. // CHECK:STDOUT: %.loc5_14.2: init %empty_struct_type = struct_init () to file.%_.var [concrete = constants.%empty_struct]
  161. // CHECK:STDOUT: %.loc5_1: init %empty_struct_type = converted %.loc5_14.1, %.loc5_14.2 [concrete = constants.%empty_struct]
  162. // CHECK:STDOUT: assign file.%_.var, %.loc5_1
  163. // CHECK:STDOUT: return
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: --- function.carbon
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: constants {
  169. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  170. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  171. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  172. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  173. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  174. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  175. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  176. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  177. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: file {
  181. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  182. // CHECK:STDOUT: .F = %F.decl
  183. // CHECK:STDOUT: .G = %G.decl
  184. // CHECK:STDOUT: .H = %H.decl
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  187. // CHECK:STDOUT: %_.patt: %empty_struct_type = binding_pattern _
  188. // CHECK:STDOUT: %_.param_patt: %empty_struct_type = value_param_pattern %_.patt, call_param0
  189. // CHECK:STDOUT: } {
  190. // CHECK:STDOUT: %_.param: %empty_struct_type = value_param call_param0
  191. // CHECK:STDOUT: %.loc4_10.1: type = splice_block %.loc4_10.3 [concrete = constants.%empty_struct_type] {
  192. // CHECK:STDOUT: %.loc4_10.2: %empty_struct_type = struct_literal ()
  193. // CHECK:STDOUT: %.loc4_10.3: type = converted %.loc4_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT: %_: %empty_struct_type = bind_name _, %_.param
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  198. // CHECK:STDOUT: %_.patt: %empty_struct_type = binding_pattern _
  199. // CHECK:STDOUT: %_.param_patt: %empty_struct_type = value_param_pattern %_.patt, call_param0
  200. // CHECK:STDOUT: } {
  201. // CHECK:STDOUT: %_.param: %empty_struct_type = value_param call_param0
  202. // CHECK:STDOUT: %.loc6_10.1: type = splice_block %.loc6_10.3 [concrete = constants.%empty_struct_type] {
  203. // CHECK:STDOUT: %.loc6_10.2: %empty_struct_type = struct_literal ()
  204. // CHECK:STDOUT: %.loc6_10.3: type = converted %.loc6_10.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT: %_: %empty_struct_type = bind_name _, %_.param
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {} {}
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT:
  211. // CHECK:STDOUT: fn @F(%_.param: %empty_struct_type);
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: fn @G(%_.param: %empty_struct_type) {
  214. // CHECK:STDOUT: !entry:
  215. // CHECK:STDOUT: return
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: fn @H() {
  219. // CHECK:STDOUT: !entry:
  220. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  221. // CHECK:STDOUT: %.loc9_6.1: %empty_struct_type = struct_literal ()
  222. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete = constants.%empty_struct]
  223. // CHECK:STDOUT: %.loc9_6.2: %empty_struct_type = converted %.loc9_6.1, %empty_struct [concrete = constants.%empty_struct]
  224. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref(%.loc9_6.2)
  225. // CHECK:STDOUT: return
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: --- function_generic.carbon
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: constants {
  231. // CHECK:STDOUT: %_: type = bind_symbolic_name _, 0 [symbolic]
  232. // CHECK:STDOUT: %_.patt: type = symbolic_binding_pattern _, 0 [symbolic]
  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: %G.type: type = fn_type @G [concrete]
  237. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  238. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  239. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%empty_struct_type) [concrete]
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: file {
  243. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  244. // CHECK:STDOUT: .F = %F.decl
  245. // CHECK:STDOUT: .G = %G.decl
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  248. // CHECK:STDOUT: %_.patt.loc4_6.1: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  249. // CHECK:STDOUT: } {
  250. // CHECK:STDOUT: %_.loc4_6.1: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: generic fn @F(%_.loc4_6.1: type) {
  256. // CHECK:STDOUT: %_.loc4_6.2: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  257. // CHECK:STDOUT: %_.patt.loc4_6.2: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: !definition:
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: fn() {
  262. // CHECK:STDOUT: !entry:
  263. // CHECK:STDOUT: return
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: fn @G() {
  268. // CHECK:STDOUT: !entry:
  269. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  270. // CHECK:STDOUT: %.loc7_6: %empty_struct_type = struct_literal ()
  271. // CHECK:STDOUT: %.loc7_7: type = converted %.loc7_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  272. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%empty_struct_type) [concrete = constants.%F.specific_fn]
  273. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn()
  274. // CHECK:STDOUT: return
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: specific @F(constants.%_) {
  278. // CHECK:STDOUT: %_.loc4_6.2 => constants.%_
  279. // CHECK:STDOUT: %_.patt.loc4_6.2 => constants.%_.patt
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @F(constants.%empty_struct_type) {
  283. // CHECK:STDOUT: %_.loc4_6.2 => constants.%empty_struct_type
  284. // CHECK:STDOUT: %_.patt.loc4_6.2 => constants.%_.patt
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: !definition:
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: --- fail_function_generic_undefined.carbon
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: constants {
  292. // CHECK:STDOUT: %_: type = bind_symbolic_name _, 0 [symbolic]
  293. // CHECK:STDOUT: %_.patt: type = symbolic_binding_pattern _, 0 [symbolic]
  294. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  295. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  296. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  297. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  298. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  299. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  300. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F, @F(%empty_struct_type) [concrete]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: file {
  304. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  305. // CHECK:STDOUT: .F = %F.decl
  306. // CHECK:STDOUT: .G = %G.decl
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  309. // CHECK:STDOUT: %_.patt.loc4_6.1: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  310. // CHECK:STDOUT: } {
  311. // CHECK:STDOUT: %_.loc4_6.1: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {} {}
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: generic fn @F(%_.loc4_6.1: type) {
  317. // CHECK:STDOUT: %_.loc4_6.2: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  318. // CHECK:STDOUT: %_.patt.loc4_6.2: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: fn();
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: fn @G() {
  324. // CHECK:STDOUT: !entry:
  325. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  326. // CHECK:STDOUT: %.loc14_6: %empty_struct_type = struct_literal ()
  327. // CHECK:STDOUT: %.loc14_7: type = converted %.loc14_6, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  328. // CHECK:STDOUT: %F.specific_fn: <specific function> = specific_function %F.ref, @F(constants.%empty_struct_type) [concrete = constants.%F.specific_fn]
  329. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.specific_fn()
  330. // CHECK:STDOUT: return
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: specific @F(constants.%_) {
  334. // CHECK:STDOUT: %_.loc4_6.2 => constants.%_
  335. // CHECK:STDOUT: %_.patt.loc4_6.2 => constants.%_.patt
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: specific @F(constants.%empty_struct_type) {
  339. // CHECK:STDOUT: %_.loc4_6.2 => constants.%empty_struct_type
  340. // CHECK:STDOUT: %_.patt.loc4_6.2 => constants.%_.patt
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: --- function_implict.carbon
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: constants {
  346. // CHECK:STDOUT: %_: type = bind_symbolic_name _, 0 [symbolic]
  347. // CHECK:STDOUT: %_.patt: type = symbolic_binding_pattern _, 0 [symbolic]
  348. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  349. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  350. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  351. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: file {
  355. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  356. // CHECK:STDOUT: .F = %F.decl
  357. // CHECK:STDOUT: .G = %G.decl
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  360. // CHECK:STDOUT: %_.patt.loc4_6.1: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  361. // CHECK:STDOUT: } {
  362. // CHECK:STDOUT: %_.loc4_6.1: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  365. // CHECK:STDOUT: %_.patt.loc6_6.1: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc6_6.2 (constants.%_.patt)]
  366. // CHECK:STDOUT: } {
  367. // CHECK:STDOUT: %_.loc6_6.1: type = bind_symbolic_name _, 0 [symbolic = %_.loc6_6.2 (constants.%_)]
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: generic fn @F(%_.loc4_6.1: type) {
  372. // CHECK:STDOUT: %_.loc4_6.2: type = bind_symbolic_name _, 0 [symbolic = %_.loc4_6.2 (constants.%_)]
  373. // CHECK:STDOUT: %_.patt.loc4_6.2: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc4_6.2 (constants.%_.patt)]
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: fn();
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: generic fn @G(%_.loc6_6.1: type) {
  379. // CHECK:STDOUT: %_.loc6_6.2: type = bind_symbolic_name _, 0 [symbolic = %_.loc6_6.2 (constants.%_)]
  380. // CHECK:STDOUT: %_.patt.loc6_6.2: type = symbolic_binding_pattern _, 0 [symbolic = %_.patt.loc6_6.2 (constants.%_.patt)]
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: !definition:
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: fn() {
  385. // CHECK:STDOUT: !entry:
  386. // CHECK:STDOUT: return
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: specific @F(constants.%_) {
  391. // CHECK:STDOUT: %_.loc4_6.2 => constants.%_
  392. // CHECK:STDOUT: %_.patt.loc4_6.2 => constants.%_.patt
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: specific @G(constants.%_) {
  396. // CHECK:STDOUT: %_.loc6_6.2 => constants.%_
  397. // CHECK:STDOUT: %_.patt.loc6_6.2 => constants.%_.patt
  398. // CHECK:STDOUT: }
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: --- fail_class.carbon
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: constants {
  403. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: file {}
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: class @C {
  409. // CHECK:STDOUT: complete_type_witness = invalid
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: !members:
  412. // CHECK:STDOUT: .Self = constants.%C
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: --- fail_interface.carbon
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: constants {
  418. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  419. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  420. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  421. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  422. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%_ [concrete]
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: file {
  426. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  427. // CHECK:STDOUT: .I = %I.decl
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: interface @I {
  433. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  434. // CHECK:STDOUT: %_: %empty_struct_type = assoc_const_decl @_ [concrete] {
  435. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%_ [concrete = constants.%assoc0]
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: !members:
  439. // CHECK:STDOUT: .Self = %Self
  440. // CHECK:STDOUT: ._ = @_.%assoc0
  441. // CHECK:STDOUT: witness = (%_)
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: generic assoc_const @_(@I.%Self: %I.type) {
  445. // CHECK:STDOUT: assoc_const _:! %empty_struct_type;
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: specific @_(constants.%Self) {}
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: --- fail_use.carbon
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: constants {
  453. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  454. // CHECK:STDOUT: }
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: file {}
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: fn @F() -> %empty_struct_type;
  459. // CHECK:STDOUT: