missing_prelude.carbon 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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. class X {}
  34. fn Int[T:! type](unused N:! T) -> X { return {}; }
  35. interface ImplicitAs(T:! type) {
  36. fn Convert[self: Self]() -> T;
  37. }
  38. // --- fail_use_fake_int.carbon
  39. library "[[@TEST_NAME]]";
  40. import Core library "prelude_fake_int";
  41. // We don't really care whether this works, but it shouldn't crash or otherwise misbehave.
  42. // CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+14]]:17: error: cannot implicitly convert non-type value of type `Core.X` to `type` [ConversionFailureNonTypeToFacet]
  43. // CHECK:STDERR: let n: Core.X = i32;
  44. // CHECK:STDERR: ^~~
  45. // CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+11]]:17: note: type `Core.X` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
  46. // CHECK:STDERR: let n: Core.X = i32;
  47. // CHECK:STDERR: ^~~
  48. // CHECK:STDERR:
  49. // CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+7]]:17: error: cannot implicitly convert expression of type `type` to `Core.X` [ConversionFailure]
  50. // CHECK:STDERR: let n: Core.X = i32;
  51. // CHECK:STDERR: ^~~
  52. // CHECK:STDERR: fail_use_fake_int.carbon:[[@LINE+4]]:17: note: type `type` does not implement interface `Core.ImplicitAs(Core.X)` [MissingImplInMemberAccessInContext]
  53. // CHECK:STDERR: let n: Core.X = i32;
  54. // CHECK:STDERR: ^~~
  55. // CHECK:STDERR:
  56. let n: Core.X = i32;
  57. // --- prelude_use_in_prelude.carbon
  58. package Core library "[[@TEST_NAME]]";
  59. // Core is not an imported package here.
  60. class Int[T:! type](unused N:! T) {}
  61. let n: i32 = {};
  62. // --- fail_prelude_as_namespace.carbon
  63. library "[[@TEST_NAME]]";
  64. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+8]]:11: error: `namespace` introducer should be followed by a name [ExpectedDeclName]
  65. // CHECK:STDERR: namespace Core;
  66. // CHECK:STDERR: ^~~~
  67. // CHECK:STDERR:
  68. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  69. // CHECK:STDERR: namespace Core;
  70. // CHECK:STDERR: ^~~~
  71. // CHECK:STDERR:
  72. namespace Core;
  73. // CHECK:STDERR: fail_prelude_as_namespace.carbon:[[@LINE+4]]:4: error: `fn` introducer should be followed by a name [ExpectedDeclName]
  74. // CHECK:STDERR: fn Core.Int[T:! type](N:! T) -> {} { return {}; }
  75. // CHECK:STDERR: ^~~~
  76. // CHECK:STDERR:
  77. fn Core.Int[T:! type](N:! T) -> {} { return {}; }
  78. // Make sure use of `i32` doesn't crash after above errors.
  79. let n: type = i32;
  80. // --- fail_prelude_as_class.carbon
  81. library "[[@TEST_NAME]]";
  82. // CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+8]]:7: error: `class` introducer should be followed by a name [ExpectedDeclName]
  83. // CHECK:STDERR: class Core {
  84. // CHECK:STDERR: ^~~~
  85. // CHECK:STDERR:
  86. // CHECK:STDERR: fail_prelude_as_class.carbon:[[@LINE+4]]:7: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  87. // CHECK:STDERR: class Core {
  88. // CHECK:STDERR: ^~~~
  89. // CHECK:STDERR:
  90. class Core {
  91. fn Int[T:! type](N:! T) -> {} { return {}; }
  92. }
  93. let n: type = i32;
  94. // CHECK:STDOUT: --- fail_missing_prelude.carbon
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: file {
  97. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  98. // CHECK:STDOUT: .n = %n
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT: name_binding_decl {
  101. // CHECK:STDOUT: %n.patt: <error> = ref_binding_pattern n [concrete]
  102. // CHECK:STDOUT: %n.var_patt: <error> = var_pattern %n.patt [concrete]
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT: %n.var: ref <error> = var %n.var_patt [concrete = <error>]
  105. // CHECK:STDOUT: %.loc8: type = type_literal <error> [concrete = <error>]
  106. // CHECK:STDOUT: %n: ref <error> = ref_binding n, <error> [concrete = <error>]
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: fn @__global_init() {
  110. // CHECK:STDOUT: !entry:
  111. // CHECK:STDOUT: assign file.%n.var, <error>
  112. // CHECK:STDOUT: return
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: --- prelude_empty.carbon
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: file {
  118. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
  119. // CHECK:STDOUT: }
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: --- fail_missing_prelude_member.carbon
  122. // CHECK:STDOUT:
  123. // CHECK:STDOUT: imports {
  124. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  125. // CHECK:STDOUT: .Int = <poisoned>
  126. // CHECK:STDOUT: import Core//prelude_empty
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: file {
  131. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  132. // CHECK:STDOUT: .Core = imports.%Core
  133. // CHECK:STDOUT: .n = %n
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %Core.import = import Core
  136. // CHECK:STDOUT: name_binding_decl {
  137. // CHECK:STDOUT: %n.patt: <error> = ref_binding_pattern n [concrete]
  138. // CHECK:STDOUT: %n.var_patt: <error> = var_pattern %n.patt [concrete]
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: %n.var: ref <error> = var %n.var_patt [concrete = <error>]
  141. // CHECK:STDOUT: %.loc10: type = type_literal <error> [concrete = <error>]
  142. // CHECK:STDOUT: %n: ref <error> = ref_binding n, <error> [concrete = <error>]
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: fn @__global_init() {
  146. // CHECK:STDOUT: !entry:
  147. // CHECK:STDOUT: assign file.%n.var, <error>
  148. // CHECK:STDOUT: return
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: --- prelude_fake_int.carbon
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: constants {
  154. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  155. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  156. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  157. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  158. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  159. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  160. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  161. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  162. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  163. // CHECK:STDOUT: %.054: Core.Form = init_form %X [concrete]
  164. // CHECK:STDOUT: %pattern_type.1f7: type = pattern_type %X [concrete]
  165. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  166. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  167. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  168. // CHECK:STDOUT: %X.val: %X = struct_value () [concrete]
  169. // CHECK:STDOUT: %ImplicitAs.type.595: type = generic_interface_type @ImplicitAs [concrete]
  170. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.595 = struct_value () [concrete]
  171. // CHECK:STDOUT: %ImplicitAs.type.9fe: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic]
  172. // CHECK:STDOUT: %Self: %ImplicitAs.type.9fe = symbolic_binding Self, 1 [symbolic]
  173. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic]
  174. // CHECK:STDOUT: %pattern_type.8de: type = pattern_type %Self.binding.as_type [symbolic]
  175. // CHECK:STDOUT: %.184: Core.Form = init_form %T [symbolic]
  176. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%T, %Self) [symbolic]
  177. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert: %ImplicitAs.WithSelf.Convert.type = struct_value () [symbolic]
  178. // CHECK:STDOUT: %ImplicitAs.assoc_type: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%T) [symbolic]
  179. // CHECK:STDOUT: %assoc0: %ImplicitAs.assoc_type = assoc_entity element0, @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.decl [symbolic]
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: file {
  183. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  184. // CHECK:STDOUT: .X = %X.decl
  185. // CHECK:STDOUT: .Int = %Int.decl
  186. // CHECK:STDOUT: .ImplicitAs = %ImplicitAs.decl
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
  189. // CHECK:STDOUT: %Int.decl: %Int.type = fn_decl @Int [concrete = constants.%Int] {
  190. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  191. // CHECK:STDOUT: %N.patt: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  192. // CHECK:STDOUT: %return.patt: %pattern_type.1f7 = return_slot_pattern [concrete]
  193. // CHECK:STDOUT: %return.param_patt: %pattern_type.1f7 = out_param_pattern %return.patt [concrete]
  194. // CHECK:STDOUT: } {
  195. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X]
  196. // CHECK:STDOUT: %.loc6_35: Core.Form = init_form %X.ref [concrete = constants.%.054]
  197. // CHECK:STDOUT: %.loc6_12.1: type = splice_block %.loc6_12.2 [concrete = type] {
  198. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  199. // CHECK:STDOUT: %.loc6_12.2: type = type_literal type [concrete = type]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: %T.loc6_8.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_8.1 (constants.%T)]
  202. // CHECK:STDOUT: %.loc6_29: type = splice_block %T.ref [symbolic = %T.loc6_8.1 (constants.%T)] {
  203. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  204. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_8.2 [symbolic = %T.loc6_8.1 (constants.%T)]
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT: %N.loc6_25.2: @Int.%T.loc6_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc6_25.1 (constants.%N)]
  207. // CHECK:STDOUT: %return.param: ref %X = out_param call_param0
  208. // CHECK:STDOUT: %return: ref %X = return_slot %return.param
  209. // CHECK:STDOUT: }
  210. // CHECK:STDOUT: %ImplicitAs.decl: %ImplicitAs.type.595 = interface_decl @ImplicitAs [concrete = constants.%ImplicitAs.generic] {
  211. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  212. // CHECK:STDOUT: } {
  213. // CHECK:STDOUT: %.loc8_26.1: type = splice_block %.loc8_26.2 [concrete = type] {
  214. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  215. // CHECK:STDOUT: %.loc8_26.2: type = type_literal type [concrete = type]
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: %T.loc8_22.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_22.1 (constants.%T)]
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: generic interface @ImplicitAs(%T.loc8_22.2: type) {
  222. // CHECK:STDOUT: %T.loc8_22.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_22.1 (constants.%T)]
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !definition:
  225. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T.loc8_22.1)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.9fe)]
  226. // CHECK:STDOUT: %Self.loc8_32.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self.loc8_32.2 (constants.%Self)]
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: interface {
  229. // CHECK:STDOUT: %Self.loc8_32.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self.loc8_32.2 (constants.%Self)]
  230. // CHECK:STDOUT: %ImplicitAs.WithSelf.decl = interface_with_self_decl @ImplicitAs [concrete]
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: !with Self:
  233. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.decl: @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.type (%ImplicitAs.WithSelf.Convert.type) = fn_decl @ImplicitAs.WithSelf.Convert [symbolic = @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert (constants.%ImplicitAs.WithSelf.Convert)] {
  234. // CHECK:STDOUT: %self.patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc9_14 (%pattern_type.8de) = value_binding_pattern self [concrete]
  235. // CHECK:STDOUT: %self.param_patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc9_14 (%pattern_type.8de) = value_param_pattern %self.patt [concrete]
  236. // CHECK:STDOUT: %return.patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc9_28 (%pattern_type.51d) = return_slot_pattern [concrete]
  237. // CHECK:STDOUT: %return.param_patt: @ImplicitAs.WithSelf.Convert.%pattern_type.loc9_28 (%pattern_type.51d) = out_param_pattern %return.patt [concrete]
  238. // CHECK:STDOUT: } {
  239. // CHECK:STDOUT: %T.ref: type = name_ref T, @ImplicitAs.%T.loc8_22.2 [symbolic = %T (constants.%T)]
  240. // CHECK:STDOUT: %.loc9_31.2: Core.Form = init_form %T.ref [symbolic = %.loc9_31.1 (constants.%.184)]
  241. // CHECK:STDOUT: %self.param: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  242. // CHECK:STDOUT: %.loc9_20.1: type = splice_block %.loc9_20.3 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  243. // CHECK:STDOUT: %.loc9_20.2: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = specific_constant @ImplicitAs.%Self.loc8_32.1, @ImplicitAs(constants.%T) [symbolic = %Self (constants.%Self)]
  244. // CHECK:STDOUT: %Self.ref: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = name_ref Self, %.loc9_20.2 [symbolic = %Self (constants.%Self)]
  245. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  246. // CHECK:STDOUT: %.loc9_20.3: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT: %self: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  249. // CHECK:STDOUT: %return.param: ref @ImplicitAs.WithSelf.Convert.%T (%T) = out_param call_param1
  250. // CHECK:STDOUT: %return: ref @ImplicitAs.WithSelf.Convert.%T (%T) = return_slot %return.param
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT: %assoc0.loc9_32.1: @ImplicitAs.WithSelf.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type) = assoc_entity element0, %ImplicitAs.WithSelf.Convert.decl [symbolic = %assoc0.loc9_32.2 (constants.%assoc0)]
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: !members:
  255. // CHECK:STDOUT: .Self = %Self.loc8_32.1
  256. // CHECK:STDOUT: .T = <poisoned>
  257. // CHECK:STDOUT: .T = <poisoned>
  258. // CHECK:STDOUT: .Convert = @ImplicitAs.WithSelf.%assoc0.loc9_32.1
  259. // CHECK:STDOUT: witness = (@ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.decl)
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: !requires:
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: class @X {
  266. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  267. // CHECK:STDOUT: complete_type_witness = %complete_type
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: !members:
  270. // CHECK:STDOUT: .Self = constants.%X
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: generic fn @Int(%T.loc6_8.2: type, %N.loc6_25.2: @Int.%T.loc6_8.1 (%T)) {
  274. // CHECK:STDOUT: %T.loc6_8.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_8.1 (constants.%T)]
  275. // CHECK:STDOUT: %N.loc6_25.1: @Int.%T.loc6_8.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc6_25.1 (constants.%N)]
  276. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc6_8.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: !definition:
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn() -> out %return.param: %X {
  281. // CHECK:STDOUT: !entry:
  282. // CHECK:STDOUT: %.loc6_47.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  283. // CHECK:STDOUT: %.loc6_47.2: init %X to %return.param = class_init () [concrete = constants.%X.val]
  284. // CHECK:STDOUT: %.loc6_48: init %X = converted %.loc6_47.1, %.loc6_47.2 [concrete = constants.%X.val]
  285. // CHECK:STDOUT: return %.loc6_48 to %return.param
  286. // CHECK:STDOUT: }
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: generic fn @ImplicitAs.WithSelf.Convert(@ImplicitAs.%T.loc8_22.2: type, @ImplicitAs.%Self.loc8_32.1: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.9fe)) {
  290. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  291. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.9fe)]
  292. // CHECK:STDOUT: %Self: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.9fe) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self)]
  293. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  294. // CHECK:STDOUT: %pattern_type.loc9_14: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.loc9_14 (constants.%pattern_type.8de)]
  295. // CHECK:STDOUT: %.loc9_31.1: Core.Form = init_form %T [symbolic = %.loc9_31.1 (constants.%.184)]
  296. // CHECK:STDOUT: %pattern_type.loc9_28: type = pattern_type %T [symbolic = %pattern_type.loc9_28 (constants.%pattern_type.51d)]
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: fn(%self.param: @ImplicitAs.WithSelf.Convert.%Self.binding.as_type (%Self.binding.as_type)) -> out %return.param: @ImplicitAs.WithSelf.Convert.%T (%T);
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  302. // CHECK:STDOUT: %T.loc6_8.1 => constants.%T
  303. // CHECK:STDOUT: %N.loc6_25.1 => constants.%N
  304. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: specific @ImplicitAs(constants.%T) {
  308. // CHECK:STDOUT: %T.loc8_22.1 => constants.%T
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%T, constants.%Self) {}
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: specific @ImplicitAs.WithSelf.Convert(constants.%T, constants.%Self) {
  314. // CHECK:STDOUT: %T => constants.%T
  315. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.9fe
  316. // CHECK:STDOUT: %Self => constants.%Self
  317. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  318. // CHECK:STDOUT: %pattern_type.loc9_14 => constants.%pattern_type.8de
  319. // CHECK:STDOUT: %.loc9_31.1 => constants.%.184
  320. // CHECK:STDOUT: %pattern_type.loc9_28 => constants.%pattern_type.51d
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: --- fail_use_fake_int.carbon
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: constants {
  326. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  327. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  328. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  329. // CHECK:STDOUT: %pattern_type.14f: type = pattern_type %X [concrete]
  330. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  331. // CHECK:STDOUT: %Int.type: type = fn_type @Int [concrete]
  332. // CHECK:STDOUT: %Int: %Int.type = struct_value () [concrete]
  333. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  334. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  335. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  336. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  337. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function %Int, @Int(Core.IntLiteral, %int_32) [concrete]
  338. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  339. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  340. // CHECK:STDOUT: %ImplicitAs.type.031: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic]
  341. // CHECK:STDOUT: %Self.738: %ImplicitAs.type.031 = symbolic_binding Self, 1 [symbolic]
  342. // CHECK:STDOUT: %ImplicitAs.assoc_type.ff3: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%T) [symbolic]
  343. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.b3a: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%T, %Self.738) [symbolic]
  344. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.1de: %ImplicitAs.WithSelf.Convert.type.b3a = struct_value () [symbolic]
  345. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self.738 [symbolic]
  346. // CHECK:STDOUT: %pattern_type.e9a: type = pattern_type %Self.binding.as_type [symbolic]
  347. // CHECK:STDOUT: %.184: Core.Form = init_form %T [symbolic]
  348. // CHECK:STDOUT: %ImplicitAs.type.151: type = facet_type <@ImplicitAs, @ImplicitAs(type)> [concrete]
  349. // CHECK:STDOUT: %Self.a80: %ImplicitAs.type.151 = symbolic_binding Self, 1 [symbolic]
  350. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.5f1: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(type, %Self.738) [symbolic]
  351. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.0fb: %ImplicitAs.WithSelf.Convert.type.5f1 = struct_value () [symbolic]
  352. // CHECK:STDOUT: %ImplicitAs.assoc_type.ce4: type = assoc_entity_type @ImplicitAs, @ImplicitAs(type) [concrete]
  353. // CHECK:STDOUT: %assoc0.2d2: %ImplicitAs.assoc_type.ce4 = assoc_entity element0, imports.%Core.import_ref.201 [concrete]
  354. // CHECK:STDOUT: %assoc0.843: %ImplicitAs.assoc_type.ff3 = assoc_entity element0, imports.%Core.import_ref.cc1 [symbolic]
  355. // CHECK:STDOUT: %ImplicitAs.type.c56: type = facet_type <@ImplicitAs, @ImplicitAs(%X)> [concrete]
  356. // CHECK:STDOUT: %Self.672: %ImplicitAs.type.c56 = symbolic_binding Self, 1 [symbolic]
  357. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.582: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%X, %Self.738) [symbolic]
  358. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.af8: %ImplicitAs.WithSelf.Convert.type.582 = struct_value () [symbolic]
  359. // CHECK:STDOUT: %ImplicitAs.assoc_type.87b: type = assoc_entity_type @ImplicitAs, @ImplicitAs(%X) [concrete]
  360. // CHECK:STDOUT: %assoc0.594: %ImplicitAs.assoc_type.87b = assoc_entity element0, imports.%Core.import_ref.201 [concrete]
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: imports {
  364. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  365. // CHECK:STDOUT: .X = %Core.X
  366. // CHECK:STDOUT: .Int = %Core.Int
  367. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  368. // CHECK:STDOUT: import Core//prelude_fake_int
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %Core.X: type = import_ref Core//prelude_fake_int, X, loaded [concrete = constants.%X]
  371. // CHECK:STDOUT: %Core.import_ref.8f2: <witness> = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [concrete = constants.%complete_type]
  372. // CHECK:STDOUT: %Core.import_ref.689 = import_ref Core//prelude_fake_int, inst{{[0-9A-F]+}} [no loc], unloaded
  373. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude_fake_int, Int, loaded [concrete = constants.%Int]
  374. // CHECK:STDOUT: %Core.import_ref.b3bc94.1: type = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @Int.%T (constants.%T)]
  375. // CHECK:STDOUT: %Core.import_ref.b42: @Int.%T (%T) = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @Int.%N (constants.%N)]
  376. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude_fake_int, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  377. // CHECK:STDOUT: %Core.import_ref.178: @ImplicitAs.WithSelf.%ImplicitAs.assoc_type (%ImplicitAs.assoc_type.ff3) = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%assoc0 (constants.%assoc0.843)]
  378. // CHECK:STDOUT: %Core.Convert = import_ref Core//prelude_fake_int, Convert, unloaded
  379. // CHECK:STDOUT: %Core.import_ref.201: @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert.type (%ImplicitAs.WithSelf.Convert.type.b3a) = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.WithSelf.%ImplicitAs.WithSelf.Convert (constants.%ImplicitAs.WithSelf.Convert.1de)]
  380. // CHECK:STDOUT: %Core.import_ref.b3bc94.3: type = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%T (constants.%T)]
  381. // CHECK:STDOUT: %Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%Self (constants.%Self.738)]
  382. // CHECK:STDOUT: %Core.import_ref.9ec = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, unloaded
  383. // CHECK:STDOUT: %Core.import_ref.b3bc94.4: type = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, loaded [symbolic = @ImplicitAs.%T (constants.%T)]
  384. // CHECK:STDOUT: %Core.import_ref.cc1 = import_ref Core//prelude_fake_int, loc{{\d+_\d+}}, unloaded
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: file {
  388. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  389. // CHECK:STDOUT: .Core = imports.%Core
  390. // CHECK:STDOUT: .n = %n
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT: %Core.import = import Core
  393. // CHECK:STDOUT: name_binding_decl {
  394. // CHECK:STDOUT: %n.patt: %pattern_type.14f = value_binding_pattern n [concrete]
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %.loc21_12: type = splice_block %X.ref [concrete = constants.%X] {
  397. // CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
  398. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Core.X [concrete = constants.%X]
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT: %.loc21_17: %X = converted @__global_init.%.loc21_17.3, <error> [concrete = <error>]
  401. // CHECK:STDOUT: %n: %X = value_binding n, <error> [concrete = <error>]
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: generic interface @ImplicitAs(imports.%Core.import_ref.b3bc94.4: type) [from "prelude_fake_int.carbon"] {
  405. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: !definition:
  408. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  409. // CHECK:STDOUT: %Self: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: interface {
  412. // CHECK:STDOUT: !members:
  413. // CHECK:STDOUT: .Self = imports.%Core.import_ref.9ec
  414. // CHECK:STDOUT: .Convert = imports.%Core.import_ref.178
  415. // CHECK:STDOUT: witness = (imports.%Core.Convert)
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: !requires:
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: class @X [from "prelude_fake_int.carbon"] {
  422. // CHECK:STDOUT: complete_type_witness = imports.%Core.import_ref.8f2
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: !members:
  425. // CHECK:STDOUT: .Self = imports.%Core.import_ref.689
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: generic fn @Int(imports.%Core.import_ref.b3bc94.1: type, imports.%Core.import_ref.b42: @Int.%T (%T)) [from "prelude_fake_int.carbon"] {
  429. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  430. // CHECK:STDOUT: %N: @Int.%T (%T) = symbolic_binding N, 1 [symbolic = %N (constants.%N)]
  431. // CHECK:STDOUT: %pattern_type: type = pattern_type %T [symbolic = %pattern_type (constants.%pattern_type.51d)]
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: !definition:
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: fn;
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: generic fn @ImplicitAs.WithSelf.Convert(imports.%Core.import_ref.b3bc94.3: type, imports.%Core.import_ref.ac4dc5.2: @ImplicitAs.%ImplicitAs.type (%ImplicitAs.type.031)) [from "prelude_fake_int.carbon"] {
  439. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic = %T (constants.%T)]
  440. // CHECK:STDOUT: %ImplicitAs.type: type = facet_type <@ImplicitAs, @ImplicitAs(%T)> [symbolic = %ImplicitAs.type (constants.%ImplicitAs.type.031)]
  441. // CHECK:STDOUT: %Self: @ImplicitAs.WithSelf.Convert.%ImplicitAs.type (%ImplicitAs.type.031) = symbolic_binding Self, 1 [symbolic = %Self (constants.%Self.738)]
  442. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  443. // CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.e9a)]
  444. // CHECK:STDOUT: %.1: Core.Form = init_form %T [symbolic = %.1 (constants.%.184)]
  445. // CHECK:STDOUT: %pattern_type.2: type = pattern_type %T [symbolic = %pattern_type.2 (constants.%pattern_type.51d)]
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: fn;
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: fn @__global_init() {
  451. // CHECK:STDOUT: !entry:
  452. // CHECK:STDOUT: %Int.specific_fn: <specific function> = specific_function constants.%Int, @Int(Core.IntLiteral, constants.%int_32) [concrete = constants.%Int.specific_fn]
  453. // CHECK:STDOUT: %.loc21_17.1: ref %X = temporary_storage
  454. // CHECK:STDOUT: %Int.call: init %X to %.loc21_17.1 = call %Int.specific_fn()
  455. // CHECK:STDOUT: %.loc21_17.2: type = converted %Int.call, <error> [concrete = <error>]
  456. // CHECK:STDOUT: %.loc21_17.3: type = type_literal <error> [concrete = <error>]
  457. // CHECK:STDOUT: return
  458. // CHECK:STDOUT: }
  459. // CHECK:STDOUT:
  460. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  461. // CHECK:STDOUT: %T => constants.%T
  462. // CHECK:STDOUT: %N => constants.%N
  463. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: specific @Int(Core.IntLiteral, constants.%int_32) {
  467. // CHECK:STDOUT: %T => Core.IntLiteral
  468. // CHECK:STDOUT: %N => constants.%int_32
  469. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc0
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !definition:
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: specific @ImplicitAs(constants.%T) {
  475. // CHECK:STDOUT: %T => constants.%T
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%T, constants.%Self.738) {}
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: specific @ImplicitAs.WithSelf.Convert(constants.%T, constants.%Self.738) {
  481. // CHECK:STDOUT: %T => constants.%T
  482. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.031
  483. // CHECK:STDOUT: %Self => constants.%Self.738
  484. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  485. // CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.e9a
  486. // CHECK:STDOUT: %.1 => constants.%.184
  487. // CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.51d
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: specific @ImplicitAs(type) {
  491. // CHECK:STDOUT: %T => type
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: !definition:
  494. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.151
  495. // CHECK:STDOUT: %Self => constants.%Self.a80
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(type, constants.%Self.738) {
  499. // CHECK:STDOUT: !definition:
  500. // CHECK:STDOUT: %T => type
  501. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.151
  502. // CHECK:STDOUT: %Self => constants.%Self.738
  503. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type => constants.%ImplicitAs.WithSelf.Convert.type.5f1
  504. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert => constants.%ImplicitAs.WithSelf.Convert.0fb
  505. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.ce4
  506. // CHECK:STDOUT: %assoc0 => constants.%assoc0.2d2
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: specific @ImplicitAs(constants.%X) {
  510. // CHECK:STDOUT: %T => constants.%X
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: !definition:
  513. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c56
  514. // CHECK:STDOUT: %Self => constants.%Self.672
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: specific @ImplicitAs.WithSelf(constants.%X, constants.%Self.738) {
  518. // CHECK:STDOUT: !definition:
  519. // CHECK:STDOUT: %T => constants.%X
  520. // CHECK:STDOUT: %ImplicitAs.type => constants.%ImplicitAs.type.c56
  521. // CHECK:STDOUT: %Self => constants.%Self.738
  522. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type => constants.%ImplicitAs.WithSelf.Convert.type.582
  523. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert => constants.%ImplicitAs.WithSelf.Convert.af8
  524. // CHECK:STDOUT: %ImplicitAs.assoc_type => constants.%ImplicitAs.assoc_type.87b
  525. // CHECK:STDOUT: %assoc0 => constants.%assoc0.594
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: --- prelude_use_in_prelude.carbon
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: constants {
  531. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  532. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  533. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  534. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  535. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  536. // CHECK:STDOUT: %N: %T = symbolic_binding N, 1 [symbolic]
  537. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  538. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  539. // CHECK:STDOUT: %Int.246: type = class_type @Int, @Int(%T, %N) [symbolic]
  540. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  541. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  542. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  543. // CHECK:STDOUT: %pattern_type.dc0: type = pattern_type Core.IntLiteral [concrete]
  544. // CHECK:STDOUT: %Int.553: type = class_type @Int, @Int(Core.IntLiteral, %int_32) [concrete]
  545. // CHECK:STDOUT: %pattern_type.efe: type = pattern_type %Int.553 [concrete]
  546. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  547. // CHECK:STDOUT: %Int.val: %Int.553 = struct_value () [concrete]
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: file {
  551. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  552. // CHECK:STDOUT: .Int = %Int.decl
  553. // CHECK:STDOUT: .n = %n
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT: %Int.decl: %Int.type = class_decl @Int [concrete = constants.%Int.generic] {
  556. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  557. // CHECK:STDOUT: %N.patt: @Int.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  558. // CHECK:STDOUT: } {
  559. // CHECK:STDOUT: %.loc6_15.1: type = splice_block %.loc6_15.2 [concrete = type] {
  560. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  561. // CHECK:STDOUT: %.loc6_15.2: type = type_literal type [concrete = type]
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT: %T.loc6_11.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_11.1 (constants.%T)]
  564. // CHECK:STDOUT: %.loc6_32: type = splice_block %T.ref [symbolic = %T.loc6_11.1 (constants.%T)] {
  565. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  566. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc6_11.2 [symbolic = %T.loc6_11.1 (constants.%T)]
  567. // CHECK:STDOUT: }
  568. // CHECK:STDOUT: %N.loc6_28.2: @Int.%T.loc6_11.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc6_28.1 (constants.%N)]
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: name_binding_decl {
  571. // CHECK:STDOUT: %n.patt: %pattern_type.efe = value_binding_pattern n [concrete]
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT: %.loc8_8: type = type_literal constants.%Int.553 [concrete = constants.%Int.553]
  574. // CHECK:STDOUT: %.loc8_15.1: ref %Int.553 = temporary_storage
  575. // CHECK:STDOUT: %.loc8_15.2: init %Int.553 to %.loc8_15.1 = class_init () [concrete = constants.%Int.val]
  576. // CHECK:STDOUT: %.loc8_15.3: init %Int.553 = converted @__global_init.%.loc8, %.loc8_15.2 [concrete = constants.%Int.val]
  577. // CHECK:STDOUT: %.loc8_15.4: ref %Int.553 = temporary %.loc8_15.1, %.loc8_15.3
  578. // CHECK:STDOUT: %.loc8_15.5: %Int.553 = acquire_value %.loc8_15.4
  579. // CHECK:STDOUT: %n: %Int.553 = value_binding n, %.loc8_15.5
  580. // CHECK:STDOUT: }
  581. // CHECK:STDOUT:
  582. // CHECK:STDOUT: generic class @Int(%T.loc6_11.2: type, %N.loc6_28.2: @Int.%T.loc6_11.1 (%T)) {
  583. // CHECK:STDOUT: %T.loc6_11.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_11.1 (constants.%T)]
  584. // CHECK:STDOUT: %N.loc6_28.1: @Int.%T.loc6_11.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc6_28.1 (constants.%N)]
  585. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc6_11.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: !definition:
  588. // CHECK:STDOUT:
  589. // CHECK:STDOUT: class {
  590. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  591. // CHECK:STDOUT: complete_type_witness = %complete_type
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: !members:
  594. // CHECK:STDOUT: .Self = constants.%Int.246
  595. // CHECK:STDOUT: }
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: fn @__global_init() {
  599. // CHECK:STDOUT: !entry:
  600. // CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  601. // CHECK:STDOUT: return
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: specific @Int(constants.%T, constants.%N) {
  605. // CHECK:STDOUT: %T.loc6_11.1 => constants.%T
  606. // CHECK:STDOUT: %N.loc6_28.1 => constants.%N
  607. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: specific @Int(Core.IntLiteral, constants.%int_32) {
  611. // CHECK:STDOUT: %T.loc6_11.1 => Core.IntLiteral
  612. // CHECK:STDOUT: %N.loc6_28.1 => constants.%int_32
  613. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.dc0
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: !definition:
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: --- fail_prelude_as_namespace.carbon
  619. // CHECK:STDOUT:
  620. // CHECK:STDOUT: --- fail_prelude_as_class.carbon
  621. // CHECK:STDOUT: