underscore.carbon 23 KB

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