missing_prelude.carbon 18 KB

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