missing_prelude.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/missing_prelude.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/missing_prelude.carbon
  14. // --- fail_missing_prelude.carbon
  15. library "[[@TEST_NAME]]";
  16. // CHECK:STDERR: fail_missing_prelude.carbon:[[@LINE+4]]:8: error: `Core.Int` implicitly referenced here, but package `Core` not found [CoreNotFound]
  17. // CHECK:STDERR: var n: i32;
  18. // CHECK:STDERR: ^~~
  19. // CHECK:STDERR:
  20. var n: i32;
  21. // --- prelude_empty.carbon
  22. package Core library "[[@TEST_NAME]]";
  23. // --- fail_missing_prelude_member.carbon
  24. library "[[@TEST_NAME]]";
  25. import Core library "prelude_empty";
  26. // CHECK:STDERR: fail_missing_prelude_member.carbon:[[@LINE+4]]:8: error: name `Core.Int` implicitly referenced here, but not found [CoreNameNotFound]
  27. // CHECK:STDERR: var n: i32;
  28. // CHECK:STDERR: ^~~
  29. // CHECK:STDERR:
  30. var n: i32;
  31. // --- prelude_fake_int.carbon
  32. package Core library "[[@TEST_NAME]]";
  33. fn Int[T:! type](N:! T) -> {} { return {}; }
  34. // --- use_fake_int.carbon
  35. library "[[@TEST_NAME]]";
  36. import Core library "prelude_fake_int";
  37. var n: {} = i32;
  38. // --- prelude_use_in_prelude.carbon
  39. package Core library "[[@TEST_NAME]]";
  40. // Core is not an imported package here.
  41. // Note that we are intentionally using a different type here from other cases
  42. // to test that this function is called, not the one from prelude_fake_int.
  43. fn Int[T:! type](N:! T) -> () { return (); }
  44. var n: () = i32;
  45. // --- fail_prelude_as_namespace.carbon
  46. library "[[@TEST_NAME]]";
  47. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+8]]:11: error: `namespace` introducer should be followed by a name [ExpectedDeclName]
  48. // CHECK:STDERR: namespace Core;
  49. // CHECK:STDERR: ^~~~
  50. // CHECK:STDERR:
  51. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  52. // CHECK:STDERR: namespace Core;
  53. // CHECK:STDERR: ^~~~
  54. // CHECK:STDERR:
  55. namespace Core;
  56. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
  57. // CHECK:STDERR: fn Core.Int[T:! type](N:! T) -> {} { return {}; }
  58. // CHECK:STDERR: ^~~~
  59. // CHECK:STDERR:
  60. fn Core.Int[T:! type](N:! T) -> {} { return {}; }
  61. var n: {} = i32;
  62. // --- fail_prelude_as_class.carbon
  63. library "[[@TEST_NAME]]";
  64. // CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+8]]:7: error: `class` introducer should be followed by a name [ExpectedDeclName]
  65. // CHECK:STDERR: class Core {
  66. // CHECK:STDERR: ^~~~
  67. // CHECK:STDERR:
  68. // CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+4]]:7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  69. // CHECK:STDERR: class Core {
  70. // CHECK:STDERR: ^~~~
  71. // CHECK:STDERR:
  72. class Core {
  73. fn Int[T:! type](N:! T) -> {} { return {}; }
  74. }
  75. var n: {} = i32;
  76. // CHECK:STDOUT: --- fail_missing_prelude.carbon
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: constants {
  79. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: file {
  83. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  84. // CHECK:STDOUT: .n = %n
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT: name_binding_decl {
  87. // CHECK:STDOUT: %n.patt: <error> = ref_binding_pattern n [concrete]
  88. // CHECK:STDOUT: %n.var_patt: <error> = var_pattern %n.patt [concrete]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT: %n.var: ref <error> = var %n.var_patt [concrete = <error>]
  91. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  92. // CHECK:STDOUT: %n: ref <error> = ref_binding n, <error> [concrete = <error>]
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: --- prelude_empty.carbon
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: file {
  98. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: --- fail_missing_prelude_member.carbon
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: constants {
  104. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: imports {
  108. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  109. // CHECK:STDOUT: .Int = <poisoned>
  110. // CHECK:STDOUT: import Core//prelude_empty
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: file {
  115. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  116. // CHECK:STDOUT: .Core = imports.%Core
  117. // CHECK:STDOUT: .n = %n
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %Core.import = import Core
  120. // CHECK:STDOUT: name_binding_decl {
  121. // CHECK:STDOUT: %n.patt: <error> = ref_binding_pattern n [concrete]
  122. // CHECK:STDOUT: %n.var_patt: <error> = var_pattern %n.patt [concrete]
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %n.var: ref <error> = var %n.var_patt [concrete = <error>]
  125. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  126. // CHECK:STDOUT: %n: ref <error> = ref_binding n, <error> [concrete = <error>]
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: --- prelude_fake_int.carbon
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: constants {
  132. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  133. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  134. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  135. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  136. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  137. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  138. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  139. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  140. // CHECK:STDOUT: %.e6e: form = init_form %empty_struct_type, call_param0 [concrete]
  141. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  142. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  143. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: file {
  147. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  148. // CHECK:STDOUT: .Int = %Int.decl
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] {
  151. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  152. // CHECK:STDOUT: %N.patt: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  153. // CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern [concrete]
  154. // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern %return.patt, call_param0 [concrete]
  155. // CHECK:STDOUT: } {
  156. // CHECK:STDOUT: %.loc4_29.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  157. // CHECK:STDOUT: %.loc4_29.2: type = converted %.loc4_29.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  158. // CHECK:STDOUT: %.loc4_29.3: form = init_form %.loc4_29.2, call_param0 [concrete = constants.%.e6e]
  159. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  160. // CHECK:STDOUT: %T.loc4_8.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_8.1 (constants.%T)]
  161. // CHECK:STDOUT: %.loc4_22: type = splice_block %T.ref [symbolic = %T.loc4_8.1 (constants.%T)] {
  162. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  163. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc4_8.2 [symbolic = %T.loc4_8.1 (constants.%T)]
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %N.loc4_18.2: @Int.%T.loc4_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc4_18.1 (constants.%N)]
  166. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0
  167. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: generic fn @Int(%T.loc4_8.2: type, %N.loc4_18.2: @Int.%T.loc4_8.1 (%T)) {
  172. // CHECK:STDOUT: %T.loc4_8.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_8.1 (constants.%T)]
  173. // CHECK:STDOUT: %N.loc4_18.1: @Int.%T.loc4_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc4_18.1 (constants.%N)]
  174. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc4_8.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: !definition:
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: fn() -> %empty_struct_type {
  179. // CHECK:STDOUT: !entry:
  180. // CHECK:STDOUT: %.loc4_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  181. // CHECK:STDOUT: %.loc4_41.2: init %empty_struct_type = struct_init () to %return.param [concrete = constants.%empty_struct]
  182. // CHECK:STDOUT: %.loc4_42: init %empty_struct_type = converted %.loc4_41.1, %.loc4_41.2 [concrete = constants.%empty_struct]
  183. // CHECK:STDOUT: return %.loc4_42 to %return.param
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  188. // CHECK:STDOUT: %T.loc4_8.1 => constants.%T
  189. // CHECK:STDOUT: %N.loc4_18.1 => constants.%N
  190. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: --- use_fake_int.carbon
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: constants {
  196. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  197. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  198. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  199. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  200. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  201. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  202. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  203. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  204. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  205. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  206. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function %Int, @Int(Core.IntLiteral, %int_32) [concrete]
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: imports {
  210. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  211. // CHECK:STDOUT: .Int = %Core.Int
  212. // CHECK:STDOUT: import Core//prelude_fake_int
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude_fake_int, Int, loaded [concrete = constants.%Int]
  215. // CHECK:STDOUT: %Core.import_ref.b3b: type = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @Int.%T (constants.%T)]
  216. // CHECK:STDOUT: %Core.import_ref.b42: @Int.%T (%T) = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @Int.%N (constants.%N)]
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT:
  219. // CHECK:STDOUT: file {
  220. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  221. // CHECK:STDOUT: .Core = imports.%Core
  222. // CHECK:STDOUT: .n = %n
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %Core.import = import Core
  225. // CHECK:STDOUT: name_binding_decl {
  226. // CHECK:STDOUT: %n.patt: %pattern_type.a96 = ref_binding_pattern n [concrete]
  227. // CHECK:STDOUT: %n.var_patt: %pattern_type.a96 = var_pattern %n.patt [concrete]
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %n.var: ref %empty_struct_type = var %n.var_patt [concrete]
  230. // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [concrete = constants.%empty_struct_type] {
  231. // CHECK:STDOUT: %.loc6_9.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  232. // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %n: ref %empty_struct_type = ref_binding n, %n.var [concrete = %n.var]
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: generic fn @Int(imports.%Core.import_ref.b3b: type, imports.%Core.import_ref.b42: @Int.%T (%T)) [from "prelude_fake_int.carbon"] {
  238. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  239. // CHECK:STDOUT: %N: @Int.%T (%T) = symbolic_binding N, 1 [symbolic = %N (constants.%N)]
  240. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: !definition:
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: fn;
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: fn @__global_init() {
  248. // CHECK:STDOUT: !entry:
  249. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  250. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function constants.%Int, @Int(Core.IntLiteral, constants.%int_32) [concrete = constants.%Int.specific_fn]
  251. // CHECK:STDOUT: %Int.call: init %empty_struct_type = call %Int.specific_fn()
  252. // CHECK:STDOUT: assign file.%n.var, %Int.call
  253. // CHECK:STDOUT: return
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  257. // CHECK:STDOUT: %T => constants.%T
  258. // CHECK:STDOUT: %N => constants.%N
  259. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: specific @Int(Core.IntLiteral, constants.%int_32) {
  263. // CHECK:STDOUT: %T => Core.IntLiteral
  264. // CHECK:STDOUT: %N => constants.%int_32
  265. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc0
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: !definition:
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: --- prelude_use_in_prelude.carbon
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: constants {
  273. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  274. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  275. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  276. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  277. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  278. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  279. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  280. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  281. // CHECK:STDOUT: %.62c: form = init_form %empty_tuple.type, call_param0 [concrete]
  282. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  283. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  284. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  285. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  286. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  287. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function %Int, @Int(Core.IntLiteral, %int_32) [concrete]
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: file {
  291. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  292. // CHECK:STDOUT: .Int = %Int.decl
  293. // CHECK:STDOUT: .n = %n
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] {
  296. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  297. // CHECK:STDOUT: %N.patt: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  298. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  299. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  300. // CHECK:STDOUT: } {
  301. // CHECK:STDOUT: %.loc8_29.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  302. // CHECK:STDOUT: %.loc8_29.2: type = converted %.loc8_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  303. // CHECK:STDOUT: %.loc8_29.3: form = init_form %.loc8_29.2, call_param0 [concrete = constants.%.62c]
  304. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  305. // CHECK:STDOUT: %T.loc8_8.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_8.1 (constants.%T)]
  306. // CHECK:STDOUT: %.loc8_22: type = splice_block %T.ref [symbolic = %T.loc8_8.1 (constants.%T)] {
  307. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  308. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_8.2 [symbolic = %T.loc8_8.1 (constants.%T)]
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: %N.loc8_18.2: @Int.%T.loc8_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc8_18.1 (constants.%N)]
  311. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  312. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: name_binding_decl {
  315. // CHECK:STDOUT: %n.patt: %pattern_type.cb1 = ref_binding_pattern n [concrete]
  316. // CHECK:STDOUT: %n.var_patt: %pattern_type.cb1 = var_pattern %n.patt [concrete]
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT: %n.var: ref %empty_tuple.type = var %n.var_patt [concrete]
  319. // CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] {
  320. // CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  321. // CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT: %n: ref %empty_tuple.type = ref_binding n, %n.var [concrete = %n.var]
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: generic fn @Int(%T.loc8_8.2: type, %N.loc8_18.2: @Int.%T.loc8_8.1 (%T)) {
  327. // CHECK:STDOUT: %T.loc8_8.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_8.1 (constants.%T)]
  328. // CHECK:STDOUT: %N.loc8_18.1: @Int.%T.loc8_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc8_18.1 (constants.%N)]
  329. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc8_8.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: !definition:
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: fn() -> %empty_tuple.type {
  334. // CHECK:STDOUT: !entry:
  335. // CHECK:STDOUT: %.loc8_41.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  336. // CHECK:STDOUT: %.loc8_41.2: init %empty_tuple.type = tuple_init () to %return.param [concrete = constants.%empty_tuple]
  337. // CHECK:STDOUT: %.loc8_42: init %empty_tuple.type = converted %.loc8_41.1, %.loc8_41.2 [concrete = constants.%empty_tuple]
  338. // CHECK:STDOUT: return %.loc8_42 to %return.param
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: fn @__global_init() {
  343. // CHECK:STDOUT: !entry:
  344. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  345. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function constants.%Int, @Int(Core.IntLiteral, constants.%int_32) [concrete = constants.%Int.specific_fn]
  346. // CHECK:STDOUT: %Int.call: init %empty_tuple.type = call %Int.specific_fn()
  347. // CHECK:STDOUT: assign file.%n.var, %Int.call
  348. // CHECK:STDOUT: return
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  352. // CHECK:STDOUT: %T.loc8_8.1 => constants.%T
  353. // CHECK:STDOUT: %N.loc8_18.1 => constants.%N
  354. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: specific @Int(Core.IntLiteral, constants.%int_32) {
  358. // CHECK:STDOUT: %T.loc8_8.1 => Core.IntLiteral
  359. // CHECK:STDOUT: %N.loc8_18.1 => constants.%int_32
  360. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc0
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: !definition:
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: --- fail_prelude_as_namespace.carbon
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: --- fail_prelude_as_class.carbon
  368. // CHECK:STDOUT: