name_poisoning.carbon 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  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/function/declaration/no_prelude/name_poisoning.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/name_poisoning.carbon
  10. // --- no_poison.carbon
  11. library "[[@TEST_NAME]]";
  12. class C {};
  13. // Both N.F1 and N.F2 use N.C and not C.
  14. namespace N;
  15. class N.C {}
  16. fn N.F1(x: C);
  17. fn N.F2(x: C) { N.F1(x); }
  18. // --- poison.carbon
  19. library "[[@TEST_NAME]]";
  20. class C {};
  21. namespace N;
  22. // Here we use C and poison N.C.
  23. fn N.F1(x: C);
  24. // --- fail_poison_class_without_usage.carbon
  25. // CHECK:STDERR: fail_poison_class_without_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  26. library "[[@TEST_NAME]]";
  27. class C {};
  28. namespace N;
  29. // Here we use C and poison N.C.
  30. fn N.F1(x: C);
  31. // Should fail here since C was poisoned for namespace N when it was used in N
  32. // context without qualification.
  33. // CHECK:STDERR: fail_poison_class_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  34. // CHECK:STDERR: class N.C {}
  35. // CHECK:STDERR: ^~~~~~~~~~~
  36. // CHECK:STDERR:
  37. class N.C {}
  38. // --- fail_poison_interface_without_usage.carbon
  39. // CHECK:STDERR: fail_poison_interface_without_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  40. library "[[@TEST_NAME]]";
  41. interface I {};
  42. namespace N;
  43. // Here we use I and poison N.I.
  44. fn N.F1(x: I);
  45. // Should fail here since I was poisoned for namespace N when it was used in N
  46. // context without qualification.
  47. // CHECK:STDERR: fail_poison_interface_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  48. // CHECK:STDERR: interface N.I {}
  49. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  50. // CHECK:STDERR:
  51. interface N.I {}
  52. // --- fail_poison_namespace_without_usage.carbon
  53. // CHECK:STDERR: fail_poison_namespace_without_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  54. library "[[@TEST_NAME]]";
  55. class C {};
  56. namespace N;
  57. // Here we use C and poison N.C.
  58. fn N.F1(x: C);
  59. // Should fail here since C was poisoned for namespace N when it was used in N
  60. // context without qualification.
  61. // CHECK:STDERR: fail_poison_namespace_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  62. // CHECK:STDERR: namespace N.C;
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~
  64. // CHECK:STDERR:
  65. namespace N.C;
  66. // --- fail_poison_member_without_usage.carbon
  67. // CHECK:STDERR: fail_poison_member_without_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  68. library "[[@TEST_NAME]]";
  69. class C1 {};
  70. class D {
  71. // Here we use C1 and poison D.C1.
  72. fn F1(x: C1);
  73. class C2 {};
  74. // Should fail here since C1 was poisoned for namespace class D when it was
  75. // used in D context without qualification.
  76. // CHECK:STDERR: fail_poison_member_without_usage.carbon:[[@LINE+4]]:7: note: declared here [NameUseBeforeDeclNote]
  77. // CHECK:STDERR: var C1: C2;
  78. // CHECK:STDERR: ^~~~~~
  79. // CHECK:STDERR:
  80. var C1: C2;
  81. }
  82. // --- fail_poison_function_without_usage.carbon
  83. // CHECK:STDERR: fail_poison_function_without_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  84. library "[[@TEST_NAME]]";
  85. class C {};
  86. namespace N;
  87. // Here we use C and poison N.C.
  88. fn N.F1(x: C);
  89. // Should fail here since C was poisoned for namespace N when it was used in N
  90. // context without qualification.
  91. // CHECK:STDERR: fail_poison_function_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  92. // CHECK:STDERR: fn N.C();
  93. // CHECK:STDERR: ^~~~~~~~~
  94. // CHECK:STDERR:
  95. fn N.C();
  96. // --- fail_use_undefined_poisoned_name.carbon
  97. library "[[@TEST_NAME]]";
  98. class C {};
  99. namespace N;
  100. // Here we use C and poison N.C.
  101. fn N.F1() -> C;
  102. // Try to use N.C which was never defined and poisoned.
  103. // CHECK:STDERR: fail_use_undefined_poisoned_name.carbon:[[@LINE+4]]:14: error: member name `C` not found in `N` [MemberNameNotFoundInScope]
  104. // CHECK:STDERR: fn N.F2() -> N.C;
  105. // CHECK:STDERR: ^~~
  106. // CHECK:STDERR:
  107. fn N.F2() -> N.C;
  108. // --- fail_poison_with_usage.carbon
  109. // CHECK:STDERR: fail_poison_with_usage.carbon: error: name used before it was declared [NameUseBeforeDecl]
  110. library "[[@TEST_NAME]]";
  111. class C {};
  112. namespace N;
  113. // Here we use C and poison N.C.
  114. fn N.F1(x: C);
  115. // Should fail here since C was poisoned for namespace N when it was used in N
  116. // context without qualification.
  117. // CHECK:STDERR: fail_poison_with_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  118. // CHECK:STDERR: class N.C {}
  119. // CHECK:STDERR: ^~~~~~~~~~~
  120. // CHECK:STDERR:
  121. class N.C {}
  122. // Should not fail here since both N.F2() and N.F1() input is the class C and
  123. // not class N.C.
  124. fn N.F2(x: C) { N.F1(x); }
  125. // --- fail_poison_multiple_scopes.carbon
  126. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  127. library "[[@TEST_NAME]]";
  128. class C {};
  129. namespace N1;
  130. namespace N1.N2;
  131. namespace N1.N2.N3;
  132. class N1.N2.N3.D1 {
  133. interface D2 {
  134. class D3 {
  135. // Here we use C and poison:
  136. // * N1.C
  137. // * N1.N2.C
  138. // * N1.N2.N3.C
  139. // * N1.N2.N3.D1.C
  140. // * N1.N2.N3.D1.D2.C
  141. // * N1.N2.N3.D1.D2.D3.C
  142. fn F(x: C);
  143. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+5]]:7: note: declared here [NameUseBeforeDeclNote]
  144. // CHECK:STDERR: class C {}
  145. // CHECK:STDERR: ^~~~~~~~~
  146. // CHECK:STDERR:
  147. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  148. class C {}
  149. }
  150. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+5]]:5: note: declared here [NameUseBeforeDeclNote]
  151. // CHECK:STDERR: class C {}
  152. // CHECK:STDERR: ^~~~~~~~~
  153. // CHECK:STDERR:
  154. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  155. class C {}
  156. }
  157. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+5]]:3: note: declared here [NameUseBeforeDeclNote]
  158. // CHECK:STDERR: class C {}
  159. // CHECK:STDERR: ^~~~~~~~~
  160. // CHECK:STDERR:
  161. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  162. class C {}
  163. }
  164. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+5]]:1: note: declared here [NameUseBeforeDeclNote]
  165. // CHECK:STDERR: class N1.C {}
  166. // CHECK:STDERR: ^~~~~~~~~~~~
  167. // CHECK:STDERR:
  168. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  169. class N1.C {}
  170. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+5]]:1: note: declared here [NameUseBeforeDeclNote]
  171. // CHECK:STDERR: interface N1.N2.C {}
  172. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  173. // CHECK:STDERR:
  174. // CHECK:STDERR: fail_poison_multiple_scopes.carbon: error: name used before it was declared [NameUseBeforeDecl]
  175. interface N1.N2.C {}
  176. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  177. // CHECK:STDERR: class N1.N2.N3.C {}
  178. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  179. // CHECK:STDERR:
  180. class N1.N2.N3.C {}
  181. // --- fail_alias.carbon
  182. // CHECK:STDERR: fail_alias.carbon: error: name used before it was declared [NameUseBeforeDecl]
  183. library "[[@TEST_NAME]]";
  184. class C {}
  185. namespace N;
  186. // CHECK:STDERR: fail_alias.carbon:[[@LINE+3]]:9: note: declared here [NameUseBeforeDeclNote]
  187. // CHECK:STDERR: alias N.C = C;
  188. // CHECK:STDERR: ^
  189. alias N.C = C;
  190. // --- ignored_poison_in_import.carbon
  191. library "[[@TEST_NAME]]";
  192. import library "poison";
  193. // This doesn't fail.
  194. class N.C {}
  195. // --- poison.impl.carbon
  196. impl library "[[@TEST_NAME]]";
  197. // TODO: This should fail since N.C was poisoned in the api.
  198. class N.C {}
  199. // CHECK:STDOUT: --- no_poison.carbon
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: constants {
  202. // CHECK:STDOUT: %C.1: type = class_type @C.1 [template]
  203. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  204. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  205. // CHECK:STDOUT: %C.2: type = class_type @C.2 [template]
  206. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  207. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  208. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  209. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  210. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: file {
  214. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  215. // CHECK:STDOUT: .C = %C.decl.loc4
  216. // CHECK:STDOUT: .N = %N
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.1 [template = constants.%C.1] {} {}
  219. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  220. // CHECK:STDOUT: .C = %C.decl.loc8
  221. // CHECK:STDOUT: .F1 = %F1.decl
  222. // CHECK:STDOUT: .F2 = %F2.decl
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %C.decl.loc8: type = class_decl @C.2 [template = constants.%C.2] {} {}
  225. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  226. // CHECK:STDOUT: %x.patt: %C.2 = binding_pattern x
  227. // CHECK:STDOUT: %x.param_patt: %C.2 = value_param_pattern %x.patt, runtime_param0
  228. // CHECK:STDOUT: } {
  229. // CHECK:STDOUT: %x.param: %C.2 = value_param runtime_param0
  230. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc8 [template = constants.%C.2]
  231. // CHECK:STDOUT: %x: %C.2 = bind_name x, %x.param
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  234. // CHECK:STDOUT: %x.patt: %C.2 = binding_pattern x
  235. // CHECK:STDOUT: %x.param_patt: %C.2 = value_param_pattern %x.patt, runtime_param0
  236. // CHECK:STDOUT: } {
  237. // CHECK:STDOUT: %x.param: %C.2 = value_param runtime_param0
  238. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc8 [template = constants.%C.2]
  239. // CHECK:STDOUT: %x: %C.2 = bind_name x, %x.param
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: class @C.1 {
  244. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: !members:
  247. // CHECK:STDOUT: .Self = constants.%C.1
  248. // CHECK:STDOUT: complete_type_witness = %complete_type
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: class @C.2 {
  252. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: !members:
  255. // CHECK:STDOUT: .Self = constants.%C.2
  256. // CHECK:STDOUT: complete_type_witness = %complete_type
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.2);
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: fn @F2(%x.param_patt: %C.2) {
  262. // CHECK:STDOUT: !entry:
  263. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  264. // CHECK:STDOUT: %F1.ref: %F1.type = name_ref F1, file.%F1.decl [template = constants.%F1]
  265. // CHECK:STDOUT: %x.ref: %C.2 = name_ref x, %x
  266. // CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %F1.ref(%x.ref)
  267. // CHECK:STDOUT: return
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: --- poison.carbon
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: constants {
  273. // CHECK:STDOUT: %C: type = class_type @C [template]
  274. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  275. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  276. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  277. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: file {
  281. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  282. // CHECK:STDOUT: .C = %C.decl
  283. // CHECK:STDOUT: .N = %N
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  286. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  287. // CHECK:STDOUT: .F1 = %F1.decl
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  290. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  291. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  292. // CHECK:STDOUT: } {
  293. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  294. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  295. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: class @C {
  300. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: !members:
  303. // CHECK:STDOUT: .Self = constants.%C
  304. // CHECK:STDOUT: complete_type_witness = %complete_type
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: --- fail_poison_class_without_usage.carbon
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: constants {
  312. // CHECK:STDOUT: %C: type = class_type @C [template]
  313. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  314. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  315. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  316. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  317. // CHECK:STDOUT: %.1: type = class_type @.1 [template]
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: file {
  321. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  322. // CHECK:STDOUT: .C = %C.decl
  323. // CHECK:STDOUT: .N = %N
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  326. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  327. // CHECK:STDOUT: .F1 = %F1.decl
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  330. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  331. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  332. // CHECK:STDOUT: } {
  333. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  334. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  335. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT: %.decl: type = class_decl @.1 [template = constants.%.1] {} {}
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: class @C {
  341. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: !members:
  344. // CHECK:STDOUT: .Self = constants.%C
  345. // CHECK:STDOUT: complete_type_witness = %complete_type
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: class @.1 {
  349. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: !members:
  352. // CHECK:STDOUT: .Self = constants.%.1
  353. // CHECK:STDOUT: complete_type_witness = %complete_type
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: --- fail_poison_interface_without_usage.carbon
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: constants {
  361. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  362. // CHECK:STDOUT: %Self.1: %I.type = bind_symbolic_name Self, 0 [symbolic]
  363. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  364. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  365. // CHECK:STDOUT: %.type: type = facet_type <@.1> [template]
  366. // CHECK:STDOUT: %Self.2: %.type = bind_symbolic_name Self, 0 [symbolic]
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: file {
  370. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  371. // CHECK:STDOUT: .I = %I.decl
  372. // CHECK:STDOUT: .N = %N
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  375. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  376. // CHECK:STDOUT: .F1 = %F1.decl
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  379. // CHECK:STDOUT: %x.patt: %I.type = binding_pattern x
  380. // CHECK:STDOUT: %x.param_patt: %I.type = value_param_pattern %x.patt, runtime_param0
  381. // CHECK:STDOUT: } {
  382. // CHECK:STDOUT: %x.param: %I.type = value_param runtime_param0
  383. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  384. // CHECK:STDOUT: %x: %I.type = bind_name x, %x.param
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT: %.decl: type = interface_decl @.1 [template = constants.%.type] {} {}
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: interface @I {
  390. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: !members:
  393. // CHECK:STDOUT: .Self = %Self
  394. // CHECK:STDOUT: witness = ()
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: interface @.1 {
  398. // CHECK:STDOUT: %Self: %.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: !members:
  401. // CHECK:STDOUT: .Self = %Self
  402. // CHECK:STDOUT: witness = ()
  403. // CHECK:STDOUT: }
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: fn @F1(%x.param_patt: %I.type);
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: --- fail_poison_namespace_without_usage.carbon
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: constants {
  410. // CHECK:STDOUT: %C: type = class_type @C [template]
  411. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  412. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  413. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  414. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: file {
  418. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  419. // CHECK:STDOUT: .C = %C.decl
  420. // CHECK:STDOUT: .N = %N
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  423. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  424. // CHECK:STDOUT: .F1 = %F1.decl
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  427. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  428. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  429. // CHECK:STDOUT: } {
  430. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  431. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  432. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT: %.loc17: <namespace> = namespace [template] {}
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: class @C {
  438. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: !members:
  441. // CHECK:STDOUT: .Self = constants.%C
  442. // CHECK:STDOUT: complete_type_witness = %complete_type
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: --- fail_poison_member_without_usage.carbon
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: constants {
  450. // CHECK:STDOUT: %C1: type = class_type @C1 [template]
  451. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  452. // CHECK:STDOUT: %complete_type.1: <witness> = complete_type_witness %empty_struct_type [template]
  453. // CHECK:STDOUT: %D: type = class_type @D [template]
  454. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  455. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  456. // CHECK:STDOUT: %C2: type = class_type @C2 [template]
  457. // CHECK:STDOUT: %D.elem: type = unbound_element_type %D, %C2 [template]
  458. // CHECK:STDOUT: %struct_type.C1: type = struct_type {.C1: %C2} [template]
  459. // CHECK:STDOUT: %complete_type.2: <witness> = complete_type_witness %struct_type.C1 [template]
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: file {
  463. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  464. // CHECK:STDOUT: .C1 = %C1.decl
  465. // CHECK:STDOUT: .D = %D.decl
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT: %C1.decl: type = class_decl @C1 [template = constants.%C1] {} {}
  468. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: class @C1 {
  472. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.1]
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: !members:
  475. // CHECK:STDOUT: .Self = constants.%C1
  476. // CHECK:STDOUT: complete_type_witness = %complete_type
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT:
  479. // CHECK:STDOUT: class @D {
  480. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  481. // CHECK:STDOUT: %x.patt: %C1 = binding_pattern x
  482. // CHECK:STDOUT: %x.param_patt: %C1 = value_param_pattern %x.patt, runtime_param0
  483. // CHECK:STDOUT: } {
  484. // CHECK:STDOUT: %x.param: %C1 = value_param runtime_param0
  485. // CHECK:STDOUT: %C1.ref: type = name_ref C1, file.%C1.decl [template = constants.%C1]
  486. // CHECK:STDOUT: %x: %C1 = bind_name x, %x.param
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %C2.decl: type = class_decl @C2 [template = constants.%C2] {} {}
  489. // CHECK:STDOUT: %.loc18: %D.elem = field_decl C1, element0 [template]
  490. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.C1 [template = constants.%complete_type.2]
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: !members:
  493. // CHECK:STDOUT: .Self = constants.%D
  494. // CHECK:STDOUT: .F1 = %F1.decl
  495. // CHECK:STDOUT: .C2 = %C2.decl
  496. // CHECK:STDOUT: complete_type_witness = %complete_type
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: class @C2 {
  500. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.1]
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: !members:
  503. // CHECK:STDOUT: .Self = constants.%C2
  504. // CHECK:STDOUT: complete_type_witness = %complete_type
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: fn @F1(%x.param_patt: %C1);
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: --- fail_poison_function_without_usage.carbon
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: constants {
  512. // CHECK:STDOUT: %C: type = class_type @C [template]
  513. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  514. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  515. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  516. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  517. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  518. // CHECK:STDOUT: %.1: %.type = struct_value () [template]
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: file {
  522. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  523. // CHECK:STDOUT: .C = %C.decl
  524. // CHECK:STDOUT: .N = %N
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  527. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  528. // CHECK:STDOUT: .F1 = %F1.decl
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  531. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  532. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  533. // CHECK:STDOUT: } {
  534. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  535. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  536. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.1] {} {}
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: class @C {
  542. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: !members:
  545. // CHECK:STDOUT: .Self = constants.%C
  546. // CHECK:STDOUT: complete_type_witness = %complete_type
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: fn @.1();
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: --- fail_use_undefined_poisoned_name.carbon
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: constants {
  556. // CHECK:STDOUT: %C: type = class_type @C [template]
  557. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  558. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  559. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  560. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  561. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  562. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT:
  565. // CHECK:STDOUT: file {
  566. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  567. // CHECK:STDOUT: .C = %C.decl
  568. // CHECK:STDOUT: .N = %N
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  571. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  572. // CHECK:STDOUT: .F1 = %F1.decl
  573. // CHECK:STDOUT: .F2 = %F2.decl
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  576. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  577. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  578. // CHECK:STDOUT: } {
  579. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  580. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  581. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  584. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern
  585. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, runtime_param0
  586. // CHECK:STDOUT: } {
  587. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  588. // CHECK:STDOUT: %C.ref: <error> = name_ref C, <error> [template = <error>]
  589. // CHECK:STDOUT: %return.param: ref <error> = out_param runtime_param0
  590. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT: }
  593. // CHECK:STDOUT:
  594. // CHECK:STDOUT: class @C {
  595. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: !members:
  598. // CHECK:STDOUT: .Self = constants.%C
  599. // CHECK:STDOUT: complete_type_witness = %complete_type
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: fn @F1() -> %C;
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: fn @F2() -> <error>;
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: --- fail_poison_with_usage.carbon
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: constants {
  609. // CHECK:STDOUT: %C: type = class_type @C [template]
  610. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  611. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  612. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  613. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  614. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  615. // CHECK:STDOUT: %.1: type = class_type @.1 [template]
  616. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  617. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT:
  620. // CHECK:STDOUT: file {
  621. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  622. // CHECK:STDOUT: .C = %C.decl
  623. // CHECK:STDOUT: .N = %N
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  626. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  627. // CHECK:STDOUT: .F1 = %F1.decl
  628. // CHECK:STDOUT: .F2 = %F2.decl
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  631. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  632. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  633. // CHECK:STDOUT: } {
  634. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  635. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  636. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT: %.decl: type = class_decl @.1 [template = constants.%.1] {} {}
  639. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  640. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  641. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  642. // CHECK:STDOUT: } {
  643. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  644. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  645. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  646. // CHECK:STDOUT: }
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: class @C {
  650. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: !members:
  653. // CHECK:STDOUT: .Self = constants.%C
  654. // CHECK:STDOUT: complete_type_witness = %complete_type
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: class @.1 {
  658. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  659. // CHECK:STDOUT:
  660. // CHECK:STDOUT: !members:
  661. // CHECK:STDOUT: .Self = constants.%.1
  662. // CHECK:STDOUT: complete_type_witness = %complete_type
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: fn @F2(%x.param_patt: %C) {
  668. // CHECK:STDOUT: !entry:
  669. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  670. // CHECK:STDOUT: %F1.ref: %F1.type = name_ref F1, file.%F1.decl [template = constants.%F1]
  671. // CHECK:STDOUT: %x.ref: %C = name_ref x, %x
  672. // CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %F1.ref(%x.ref)
  673. // CHECK:STDOUT: return
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: --- fail_poison_multiple_scopes.carbon
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: constants {
  679. // CHECK:STDOUT: %C: type = class_type @C [template]
  680. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  681. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  682. // CHECK:STDOUT: %D1: type = class_type @D1 [template]
  683. // CHECK:STDOUT: %D2.type: type = facet_type <@D2> [template]
  684. // CHECK:STDOUT: %Self.1: %D2.type = bind_symbolic_name Self, 0 [symbolic]
  685. // CHECK:STDOUT: %D3.1: type = class_type @D3 [template]
  686. // CHECK:STDOUT: %D3.2: type = class_type @D3, @D3(%Self.1) [symbolic]
  687. // CHECK:STDOUT: %F.type: type = fn_type @F, @D3(%Self.1) [symbolic]
  688. // CHECK:STDOUT: %F: %F.type = struct_value () [symbolic]
  689. // CHECK:STDOUT: %.1: type = class_type @.1 [template]
  690. // CHECK:STDOUT: %.2: type = class_type @.1, @.1(%Self.1) [symbolic]
  691. // CHECK:STDOUT: %.3: type = class_type @.2 [template]
  692. // CHECK:STDOUT: %.4: type = class_type @.2, @.2(%Self.1) [symbolic]
  693. // CHECK:STDOUT: %.5: type = class_type @.3 [template]
  694. // CHECK:STDOUT: %.6: type = class_type @.4 [template]
  695. // CHECK:STDOUT: %.type: type = facet_type <@.6> [template]
  696. // CHECK:STDOUT: %Self.2: %.type = bind_symbolic_name Self, 0 [symbolic]
  697. // CHECK:STDOUT: %.7: type = class_type @.5 [template]
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: file {
  701. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  702. // CHECK:STDOUT: .C = %C.decl
  703. // CHECK:STDOUT: .N1 = %N1
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  706. // CHECK:STDOUT: %N1: <namespace> = namespace [template] {
  707. // CHECK:STDOUT: .N2 = %N2
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT: %N2: <namespace> = namespace [template] {
  710. // CHECK:STDOUT: .N3 = %N3
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT: %N3: <namespace> = namespace [template] {
  713. // CHECK:STDOUT: .D1 = %D1.decl
  714. // CHECK:STDOUT: }
  715. // CHECK:STDOUT: %D1.decl: type = class_decl @D1 [template = constants.%D1] {} {}
  716. // CHECK:STDOUT: %.decl.loc49: type = class_decl @.4 [template = constants.%.6] {} {}
  717. // CHECK:STDOUT: %.decl.loc56: type = interface_decl @.6 [template = constants.%.type] {} {}
  718. // CHECK:STDOUT: %.decl.loc62: type = class_decl @.5 [template = constants.%.7] {} {}
  719. // CHECK:STDOUT: }
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: interface @D2 {
  722. // CHECK:STDOUT: %Self: %D2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  723. // CHECK:STDOUT: %D3.decl: type = class_decl @D3 [template = constants.%D3.1] {} {}
  724. // CHECK:STDOUT: %.decl: type = class_decl @.2 [template = constants.%.3] {} {}
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: !members:
  727. // CHECK:STDOUT: .Self = %Self
  728. // CHECK:STDOUT: .D3 = %D3.decl
  729. // CHECK:STDOUT: witness = ()
  730. // CHECK:STDOUT: }
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: interface @.6 {
  733. // CHECK:STDOUT: %Self: %.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  734. // CHECK:STDOUT:
  735. // CHECK:STDOUT: !members:
  736. // CHECK:STDOUT: .Self = %Self
  737. // CHECK:STDOUT: witness = ()
  738. // CHECK:STDOUT: }
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: class @C {
  741. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: !members:
  744. // CHECK:STDOUT: .Self = constants.%C
  745. // CHECK:STDOUT: complete_type_witness = %complete_type
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: class @D1 {
  749. // CHECK:STDOUT: %D2.decl: type = interface_decl @D2 [template = constants.%D2.type] {} {}
  750. // CHECK:STDOUT: %.decl: type = class_decl @.3 [template = constants.%.5] {} {}
  751. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  752. // CHECK:STDOUT:
  753. // CHECK:STDOUT: !members:
  754. // CHECK:STDOUT: .Self = constants.%D1
  755. // CHECK:STDOUT: .D2 = %D2.decl
  756. // CHECK:STDOUT: complete_type_witness = %complete_type
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: generic class @D3(@D2.%Self: %D2.type) {
  760. // CHECK:STDOUT: !definition:
  761. // CHECK:STDOUT: %Self: %D2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.1)]
  762. // CHECK:STDOUT: %F.type: type = fn_type @F, @D3(%Self) [symbolic = %F.type (constants.%F.type)]
  763. // CHECK:STDOUT: %F: @D3.%F.type (%F.type) = struct_value () [symbolic = %F (constants.%F)]
  764. // CHECK:STDOUT:
  765. // CHECK:STDOUT: class {
  766. // CHECK:STDOUT: %F.decl: @D3.%F.type (%F.type) = fn_decl @F [symbolic = @D3.%F (constants.%F)] {
  767. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  768. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  769. // CHECK:STDOUT: } {
  770. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  771. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  772. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT: %.decl: type = class_decl @.1 [template = constants.%.1] {} {}
  775. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  776. // CHECK:STDOUT:
  777. // CHECK:STDOUT: !members:
  778. // CHECK:STDOUT: .Self = constants.%D3.2
  779. // CHECK:STDOUT: .F = %F.decl
  780. // CHECK:STDOUT: complete_type_witness = %complete_type
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT: }
  783. // CHECK:STDOUT:
  784. // CHECK:STDOUT: generic class @.1(@D2.%Self: %D2.type) {
  785. // CHECK:STDOUT: !definition:
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: class {
  788. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  789. // CHECK:STDOUT:
  790. // CHECK:STDOUT: !members:
  791. // CHECK:STDOUT: .Self = constants.%.2
  792. // CHECK:STDOUT: complete_type_witness = %complete_type
  793. // CHECK:STDOUT: }
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: generic class @.2(@D2.%Self: %D2.type) {
  797. // CHECK:STDOUT: !definition:
  798. // CHECK:STDOUT:
  799. // CHECK:STDOUT: class {
  800. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  801. // CHECK:STDOUT:
  802. // CHECK:STDOUT: !members:
  803. // CHECK:STDOUT: .Self = constants.%.4
  804. // CHECK:STDOUT: complete_type_witness = %complete_type
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: class @.3 {
  809. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: !members:
  812. // CHECK:STDOUT: .Self = constants.%.5
  813. // CHECK:STDOUT: complete_type_witness = %complete_type
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: class @.4 {
  817. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  818. // CHECK:STDOUT:
  819. // CHECK:STDOUT: !members:
  820. // CHECK:STDOUT: .Self = constants.%.6
  821. // CHECK:STDOUT: complete_type_witness = %complete_type
  822. // CHECK:STDOUT: }
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: class @.5 {
  825. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: !members:
  828. // CHECK:STDOUT: .Self = constants.%.7
  829. // CHECK:STDOUT: complete_type_witness = %complete_type
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: generic fn @F(@D2.%Self: %D2.type) {
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: fn(%x.param_patt: %C);
  835. // CHECK:STDOUT: }
  836. // CHECK:STDOUT:
  837. // CHECK:STDOUT: specific @D3(constants.%Self.1) {}
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: specific @F(constants.%Self.1) {}
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: specific @.1(constants.%Self.1) {}
  842. // CHECK:STDOUT:
  843. // CHECK:STDOUT: specific @D3(%Self) {}
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: specific @.2(constants.%Self.1) {}
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: --- fail_alias.carbon
  848. // CHECK:STDOUT:
  849. // CHECK:STDOUT: constants {
  850. // CHECK:STDOUT: %C: type = class_type @C [template]
  851. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  852. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  853. // CHECK:STDOUT: }
  854. // CHECK:STDOUT:
  855. // CHECK:STDOUT: file {
  856. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  857. // CHECK:STDOUT: .C = %C.decl
  858. // CHECK:STDOUT: .N = %N
  859. // CHECK:STDOUT: }
  860. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  861. // CHECK:STDOUT: %N: <namespace> = namespace [template] {}
  862. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  863. // CHECK:STDOUT: %.loc11: type = bind_alias <invalid>, %C.decl [template = constants.%C]
  864. // CHECK:STDOUT: }
  865. // CHECK:STDOUT:
  866. // CHECK:STDOUT: class @C {
  867. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  868. // CHECK:STDOUT:
  869. // CHECK:STDOUT: !members:
  870. // CHECK:STDOUT: .Self = constants.%C
  871. // CHECK:STDOUT: complete_type_witness = %complete_type
  872. // CHECK:STDOUT: }
  873. // CHECK:STDOUT:
  874. // CHECK:STDOUT: --- ignored_poison_in_import.carbon
  875. // CHECK:STDOUT:
  876. // CHECK:STDOUT: constants {
  877. // CHECK:STDOUT: %C: type = class_type @C [template]
  878. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  879. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  880. // CHECK:STDOUT: }
  881. // CHECK:STDOUT:
  882. // CHECK:STDOUT: imports {
  883. // CHECK:STDOUT: %import_ref.1 = import_ref Main//poison, C, unloaded
  884. // CHECK:STDOUT: %import_ref.2: <namespace> = import_ref Main//poison, N, loaded
  885. // CHECK:STDOUT: %N: <namespace> = namespace %import_ref.2, [template] {
  886. // CHECK:STDOUT: .F1 = %import_ref.3
  887. // CHECK:STDOUT: .C = file.%C.decl
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT: }
  890. // CHECK:STDOUT:
  891. // CHECK:STDOUT: file {
  892. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  893. // CHECK:STDOUT: .C = imports.%import_ref.1
  894. // CHECK:STDOUT: .N = imports.%N
  895. // CHECK:STDOUT: }
  896. // CHECK:STDOUT: %default.import = import <invalid>
  897. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: class @C {
  901. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  902. // CHECK:STDOUT:
  903. // CHECK:STDOUT: !members:
  904. // CHECK:STDOUT: .Self = constants.%C
  905. // CHECK:STDOUT: complete_type_witness = %complete_type
  906. // CHECK:STDOUT: }
  907. // CHECK:STDOUT:
  908. // CHECK:STDOUT: --- poison.impl.carbon
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: constants {
  911. // CHECK:STDOUT: %C: type = class_type @C [template]
  912. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  913. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT:
  916. // CHECK:STDOUT: imports {
  917. // CHECK:STDOUT: %import_ref.1 = import_ref Main//poison, C, unloaded
  918. // CHECK:STDOUT: %import_ref.2: <namespace> = import_ref Main//poison, N, loaded
  919. // CHECK:STDOUT: %N: <namespace> = namespace %import_ref.2, [template] {
  920. // CHECK:STDOUT: .F1 = %import_ref.3
  921. // CHECK:STDOUT: .C = file.%C.decl
  922. // CHECK:STDOUT: }
  923. // CHECK:STDOUT: }
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: file {
  926. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  927. // CHECK:STDOUT: .C = imports.%import_ref.1
  928. // CHECK:STDOUT: .N = imports.%N
  929. // CHECK:STDOUT: }
  930. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  931. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  932. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  933. // CHECK:STDOUT: }
  934. // CHECK:STDOUT:
  935. // CHECK:STDOUT: class @C {
  936. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  937. // CHECK:STDOUT:
  938. // CHECK:STDOUT: !members:
  939. // CHECK:STDOUT: .Self = constants.%C
  940. // CHECK:STDOUT: complete_type_witness = %complete_type
  941. // CHECK:STDOUT: }
  942. // CHECK:STDOUT: