name_poisoning.carbon 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332
  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. library "[[@TEST_NAME]]";
  26. class C {};
  27. namespace N;
  28. // Here we use C and poison N.C.
  29. // CHECK:STDERR: fail_poison_class_without_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  30. // CHECK:STDERR: fn N.F1(x: C);
  31. // CHECK:STDERR: ^
  32. fn N.F1(x: C);
  33. // Should fail here since C was poisoned for namespace N when it was used in N
  34. // context without qualification.
  35. // CHECK:STDERR: fail_poison_class_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  36. // CHECK:STDERR: class N.C {}
  37. // CHECK:STDERR: ^~~~~~~~~~~
  38. // CHECK:STDERR:
  39. class N.C {}
  40. // --- fail_poison_interface_without_usage.carbon
  41. library "[[@TEST_NAME]]";
  42. interface I {};
  43. namespace N;
  44. // Here we use I and poison N.I.
  45. // CHECK:STDERR: fail_poison_interface_without_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  46. // CHECK:STDERR: fn N.F1(x: I);
  47. // CHECK:STDERR: ^
  48. fn N.F1(x: I);
  49. // Should fail here since I was poisoned for namespace N when it was used in N
  50. // context without qualification.
  51. // CHECK:STDERR: fail_poison_interface_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  52. // CHECK:STDERR: interface N.I {}
  53. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  54. // CHECK:STDERR:
  55. interface N.I {}
  56. // --- fail_poison_namespace_without_usage.carbon
  57. library "[[@TEST_NAME]]";
  58. class C {};
  59. namespace N;
  60. // Here we use C and poison N.C.
  61. // CHECK:STDERR: fail_poison_namespace_without_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  62. // CHECK:STDERR: fn N.F1(x: C);
  63. // CHECK:STDERR: ^
  64. fn N.F1(x: C);
  65. // Should fail here since C was poisoned for namespace N when it was used in N
  66. // context without qualification.
  67. // CHECK:STDERR: fail_poison_namespace_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  68. // CHECK:STDERR: namespace N.C;
  69. // CHECK:STDERR: ^~~~~~~~~~~~~~
  70. // CHECK:STDERR:
  71. namespace N.C;
  72. // --- fail_poison_member_without_usage.carbon
  73. library "[[@TEST_NAME]]";
  74. class C1 {};
  75. class D {
  76. // Here we use C1 and poison D.C1.
  77. // CHECK:STDERR: fail_poison_member_without_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  78. // CHECK:STDERR: fn F1(x: C1);
  79. // CHECK:STDERR: ^~
  80. fn F1(x: C1);
  81. class C2 {};
  82. // Should fail here since C1 was poisoned for namespace class D when it was
  83. // used in D context without qualification.
  84. // CHECK:STDERR: fail_poison_member_without_usage.carbon:[[@LINE+4]]:7: note: declared here [NameUseBeforeDeclNote]
  85. // CHECK:STDERR: var C1: C2;
  86. // CHECK:STDERR: ^~~~~~
  87. // CHECK:STDERR:
  88. var C1: C2;
  89. }
  90. // --- fail_poison_function_without_usage.carbon
  91. library "[[@TEST_NAME]]";
  92. class C {};
  93. namespace N;
  94. // Here we use C and poison N.C.
  95. // CHECK:STDERR: fail_poison_function_without_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  96. // CHECK:STDERR: fn N.F1(x: C);
  97. // CHECK:STDERR: ^
  98. fn N.F1(x: C);
  99. // Should fail here since C was poisoned for namespace N when it was used in N
  100. // context without qualification.
  101. // CHECK:STDERR: fail_poison_function_without_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  102. // CHECK:STDERR: fn N.C();
  103. // CHECK:STDERR: ^~~~~~~~~
  104. // CHECK:STDERR:
  105. fn N.C();
  106. // --- fail_use_undefined_poisoned_name.carbon
  107. library "[[@TEST_NAME]]";
  108. class C {};
  109. namespace N;
  110. // Here we use C and poison N.C.
  111. fn N.F1() -> C;
  112. // Try to use N.C which was never defined and poisoned.
  113. // CHECK:STDERR: fail_use_undefined_poisoned_name.carbon:[[@LINE+4]]:14: error: member name `C` not found in `N` [MemberNameNotFoundInScope]
  114. // CHECK:STDERR: fn N.F2() -> N.C;
  115. // CHECK:STDERR: ^~~
  116. // CHECK:STDERR:
  117. fn N.F2() -> N.C;
  118. // --- fail_poison_with_usage.carbon
  119. library "[[@TEST_NAME]]";
  120. class C {};
  121. namespace N;
  122. // Here we use C and poison N.C.
  123. // CHECK:STDERR: fail_poison_with_usage.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  124. // CHECK:STDERR: fn N.F1(x: C);
  125. // CHECK:STDERR: ^
  126. fn N.F1(x: C);
  127. // Should fail here since C was poisoned for namespace N when it was used in N
  128. // context without qualification.
  129. // CHECK:STDERR: fail_poison_with_usage.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  130. // CHECK:STDERR: class N.C {}
  131. // CHECK:STDERR: ^~~~~~~~~~~
  132. // CHECK:STDERR:
  133. class N.C {}
  134. // Should not fail here since both N.F2() and N.F1() input is the class C and
  135. // not class N.C.
  136. fn N.F2(x: C) { N.F1(x); }
  137. // --- fail_poison_multiple_scopes.carbon
  138. library "[[@TEST_NAME]]";
  139. class C {};
  140. namespace N1;
  141. namespace N1.N2;
  142. namespace N1.N2.N3;
  143. class N1.N2.N3.D1 {
  144. interface D2 {
  145. class D3 {
  146. // Here we use C and poison:
  147. // * N1.C
  148. // * N1.N2.C
  149. // * N1.N2.N3.C
  150. // * N1.N2.N3.D1.C
  151. // * N1.N2.N3.D1.D2.C
  152. // * N1.N2.N3.D1.D2.D3.C
  153. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+3]]:15: error: name used before it was declared [NameUseBeforeDecl]
  154. // CHECK:STDERR: fn F(x: C);
  155. // CHECK:STDERR: ^
  156. fn F(x: C);
  157. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:7: note: declared here [NameUseBeforeDeclNote]
  158. // CHECK:STDERR: class C {}
  159. // CHECK:STDERR: ^~~~~~~~~
  160. // CHECK:STDERR:
  161. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-6]]:15: error: name used before it was declared [NameUseBeforeDecl]
  162. // CHECK:STDERR: fn F(x: C);
  163. // CHECK:STDERR: ^
  164. class C {}
  165. }
  166. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:5: note: declared here [NameUseBeforeDeclNote]
  167. // CHECK:STDERR: class C {}
  168. // CHECK:STDERR: ^~~~~~~~~
  169. // CHECK:STDERR:
  170. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-15]]:15: error: name used before it was declared [NameUseBeforeDecl]
  171. // CHECK:STDERR: fn F(x: C);
  172. // CHECK:STDERR: ^
  173. class C {}
  174. }
  175. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:3: note: declared here [NameUseBeforeDeclNote]
  176. // CHECK:STDERR: class C {}
  177. // CHECK:STDERR: ^~~~~~~~~
  178. // CHECK:STDERR:
  179. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-24]]:15: error: name used before it was declared [NameUseBeforeDecl]
  180. // CHECK:STDERR: fn F(x: C);
  181. // CHECK:STDERR: ^
  182. class C {}
  183. }
  184. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:1: note: declared here [NameUseBeforeDeclNote]
  185. // CHECK:STDERR: class N1.C {}
  186. // CHECK:STDERR: ^~~~~~~~~~~~
  187. // CHECK:STDERR:
  188. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-34]]:15: error: name used before it was declared [NameUseBeforeDecl]
  189. // CHECK:STDERR: fn F(x: C);
  190. // CHECK:STDERR: ^
  191. class N1.C {}
  192. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+7]]:1: note: declared here [NameUseBeforeDeclNote]
  193. // CHECK:STDERR: interface N1.N2.C {}
  194. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  195. // CHECK:STDERR:
  196. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE-43]]:15: error: name used before it was declared [NameUseBeforeDecl]
  197. // CHECK:STDERR: fn F(x: C);
  198. // CHECK:STDERR: ^
  199. interface N1.N2.C {}
  200. // CHECK:STDERR: fail_poison_multiple_scopes.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  201. // CHECK:STDERR: class N1.N2.N3.C {}
  202. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  203. // CHECK:STDERR:
  204. class N1.N2.N3.C {}
  205. // --- fail_alias.carbon
  206. library "[[@TEST_NAME]]";
  207. class C {}
  208. namespace N;
  209. // CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:13: error: name used before it was declared [NameUseBeforeDecl]
  210. // CHECK:STDERR: alias N.C = C;
  211. // CHECK:STDERR: ^
  212. // CHECK:STDERR: fail_alias.carbon:[[@LINE+4]]:9: note: declared here [NameUseBeforeDeclNote]
  213. // CHECK:STDERR: alias N.C = C;
  214. // CHECK:STDERR: ^
  215. // CHECK:STDERR:
  216. alias N.C = C;
  217. // --- ignored_poison_in_import.carbon
  218. library "[[@TEST_NAME]]";
  219. import library "poison";
  220. // This doesn't fail.
  221. class N.C {}
  222. // --- poison.impl.carbon
  223. impl library "[[@TEST_NAME]]";
  224. // TODO: This should fail since N.C was poisoned in the api.
  225. class N.C {}
  226. // --- using_poisoned_name_in_impl.carbon
  227. library "[[@TEST_NAME]]";
  228. interface C {};
  229. namespace N;
  230. // Here we use C and poison N.C.
  231. fn N.F1(x: C);
  232. class N.X {
  233. extend impl as C {
  234. }
  235. }
  236. // --- fail_using_poisoned_name_in_impl_outside_class.carbon
  237. library "[[@TEST_NAME]]";
  238. interface A {
  239. fn B();
  240. }
  241. class X {
  242. extend impl as A {
  243. fn F() { return; }
  244. // CHECK:STDERR: fail_using_poisoned_name_in_impl_outside_class.carbon:[[@LINE+4]]:10: error: `impl as` can only be used in a class [ImplAsOutsideClass]
  245. // CHECK:STDERR: impl as B {}
  246. // CHECK:STDERR: ^~
  247. // CHECK:STDERR:
  248. impl as B {}
  249. }
  250. }
  251. // --- fail_poison_when_lookup_fails.carbon
  252. library "[[@TEST_NAME]]";
  253. namespace N;
  254. // CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:11: error: name `C` not found [NameNotFound]
  255. // CHECK:STDERR: fn N.F(x: C);
  256. // CHECK:STDERR: ^
  257. // CHECK:STDERR:
  258. // CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+3]]:11: error: name used before it was declared [NameUseBeforeDecl]
  259. // CHECK:STDERR: fn N.F(x: C);
  260. // CHECK:STDERR: ^
  261. fn N.F(x: C);
  262. // TODO: We should ideally only produce one diagnostic here.
  263. // CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+7]]:1: note: declared here [NameUseBeforeDeclNote]
  264. // CHECK:STDERR: class C {}
  265. // CHECK:STDERR: ^~~~~~~~~
  266. // CHECK:STDERR:
  267. // CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE-7]]:11: error: name used before it was declared [NameUseBeforeDecl]
  268. // CHECK:STDERR: fn N.F(x: C);
  269. // CHECK:STDERR: ^
  270. class C {}
  271. // CHECK:STDERR: fail_poison_when_lookup_fails.carbon:[[@LINE+4]]:1: note: declared here [NameUseBeforeDeclNote]
  272. // CHECK:STDERR: class N.C {}
  273. // CHECK:STDERR: ^~~~~~~~~~~
  274. // CHECK:STDERR:
  275. class N.C {}
  276. // --- fail_poison_with_lexical_result.carbon
  277. library "[[@TEST_NAME]]";
  278. fn F() {
  279. class A {}
  280. class B {
  281. // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+3]]:12: error: name used before it was declared [NameUseBeforeDecl]
  282. // CHECK:STDERR: var v: A;
  283. // CHECK:STDERR: ^
  284. var v: A;
  285. // CHECK:STDERR: fail_poison_with_lexical_result.carbon:[[@LINE+4]]:5: note: declared here [NameUseBeforeDeclNote]
  286. // CHECK:STDERR: class A {}
  287. // CHECK:STDERR: ^~~~~~~~~
  288. // CHECK:STDERR:
  289. class A {}
  290. }
  291. }
  292. // CHECK:STDOUT: --- no_poison.carbon
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: constants {
  295. // CHECK:STDOUT: %C.f79: type = class_type @C.1 [template]
  296. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  297. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  298. // CHECK:STDOUT: %C.9f4: type = class_type @C.2 [template]
  299. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  300. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  301. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  302. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  303. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: file {
  307. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  308. // CHECK:STDOUT: .C = %C.decl.loc4
  309. // CHECK:STDOUT: .N = %N
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.1 [template = constants.%C.f79] {} {}
  312. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  313. // CHECK:STDOUT: .C = %C.decl.loc8
  314. // CHECK:STDOUT: .F1 = %F1.decl
  315. // CHECK:STDOUT: .F2 = %F2.decl
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT: %C.decl.loc8: type = class_decl @C.2 [template = constants.%C.9f4] {} {}
  318. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  319. // CHECK:STDOUT: %x.patt: %C.9f4 = binding_pattern x
  320. // CHECK:STDOUT: %x.param_patt: %C.9f4 = value_param_pattern %x.patt, runtime_param0
  321. // CHECK:STDOUT: } {
  322. // CHECK:STDOUT: %x.param: %C.9f4 = value_param runtime_param0
  323. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc8 [template = constants.%C.9f4]
  324. // CHECK:STDOUT: %x: %C.9f4 = bind_name x, %x.param
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  327. // CHECK:STDOUT: %x.patt: %C.9f4 = binding_pattern x
  328. // CHECK:STDOUT: %x.param_patt: %C.9f4 = value_param_pattern %x.patt, runtime_param0
  329. // CHECK:STDOUT: } {
  330. // CHECK:STDOUT: %x.param: %C.9f4 = value_param runtime_param0
  331. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc8 [template = constants.%C.9f4]
  332. // CHECK:STDOUT: %x: %C.9f4 = bind_name x, %x.param
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: class @C.1 {
  337. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  338. // CHECK:STDOUT: complete_type_witness = %complete_type
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: !members:
  341. // CHECK:STDOUT: .Self = constants.%C.f79
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: class @C.2 {
  345. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  346. // CHECK:STDOUT: complete_type_witness = %complete_type
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: !members:
  349. // CHECK:STDOUT: .Self = constants.%C.9f4
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.9f4);
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: fn @F2(%x.param_patt: %C.9f4) {
  355. // CHECK:STDOUT: !entry:
  356. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  357. // CHECK:STDOUT: %F1.ref: %F1.type = name_ref F1, file.%F1.decl [template = constants.%F1]
  358. // CHECK:STDOUT: %x.ref: %C.9f4 = name_ref x, %x
  359. // CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %F1.ref(%x.ref)
  360. // CHECK:STDOUT: return
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: --- poison.carbon
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: constants {
  366. // CHECK:STDOUT: %C: type = class_type @C [template]
  367. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  368. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  369. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  370. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: file {
  374. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  375. // CHECK:STDOUT: .C = %C.decl
  376. // CHECK:STDOUT: .N = %N
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  379. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  380. // CHECK:STDOUT: .F1 = %F1.decl
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  383. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  384. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  385. // CHECK:STDOUT: } {
  386. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  387. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  388. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT: }
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: class @C {
  393. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  394. // CHECK:STDOUT: complete_type_witness = %complete_type
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: !members:
  397. // CHECK:STDOUT: .Self = constants.%C
  398. // CHECK:STDOUT: }
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: --- fail_poison_class_without_usage.carbon
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: constants {
  405. // CHECK:STDOUT: %C.f79: type = class_type @C.1 [template]
  406. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  407. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  408. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  409. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  410. // CHECK:STDOUT: %C.9f4: type = class_type @C.2 [template]
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: file {
  414. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  415. // CHECK:STDOUT: .C = %C.decl.loc4
  416. // CHECK:STDOUT: .N = %N
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.1 [template = constants.%C.f79] {} {}
  419. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  420. // CHECK:STDOUT: .F1 = %F1.decl
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  423. // CHECK:STDOUT: %x.patt: %C.f79 = binding_pattern x
  424. // CHECK:STDOUT: %x.param_patt: %C.f79 = value_param_pattern %x.patt, runtime_param0
  425. // CHECK:STDOUT: } {
  426. // CHECK:STDOUT: %x.param: %C.f79 = value_param runtime_param0
  427. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc4 [template = constants.%C.f79]
  428. // CHECK:STDOUT: %x: %C.f79 = bind_name x, %x.param
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT: %C.decl.loc19: type = class_decl @C.2 [template = constants.%C.9f4] {} {}
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: class @C.1 {
  434. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  435. // CHECK:STDOUT: complete_type_witness = %complete_type
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !members:
  438. // CHECK:STDOUT: .Self = constants.%C.f79
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: class @C.2 {
  442. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  443. // CHECK:STDOUT: complete_type_witness = %complete_type
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: !members:
  446. // CHECK:STDOUT: .Self = constants.%C.9f4
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.f79);
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: --- fail_poison_interface_without_usage.carbon
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: constants {
  454. // CHECK:STDOUT: %I.type.733: type = facet_type <@I.1> [template]
  455. // CHECK:STDOUT: %Self.826: %I.type.733 = bind_symbolic_name Self, 0 [symbolic]
  456. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  457. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  458. // CHECK:STDOUT: %I.type.4da: type = facet_type <@I.2> [template]
  459. // CHECK:STDOUT: %Self.f85: %I.type.4da = bind_symbolic_name Self, 0 [symbolic]
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: file {
  463. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  464. // CHECK:STDOUT: .I = %I.decl.loc4
  465. // CHECK:STDOUT: .N = %N
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT: %I.decl.loc4: type = interface_decl @I.1 [template = constants.%I.type.733] {} {}
  468. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  469. // CHECK:STDOUT: .F1 = %F1.decl
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  472. // CHECK:STDOUT: %x.patt: %I.type.733 = binding_pattern x
  473. // CHECK:STDOUT: %x.param_patt: %I.type.733 = value_param_pattern %x.patt, runtime_param0
  474. // CHECK:STDOUT: } {
  475. // CHECK:STDOUT: %x.param: %I.type.733 = value_param runtime_param0
  476. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl.loc4 [template = constants.%I.type.733]
  477. // CHECK:STDOUT: %x: %I.type.733 = bind_name x, %x.param
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %I.decl.loc19: type = interface_decl @I.2 [template = constants.%I.type.4da] {} {}
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT:
  482. // CHECK:STDOUT: interface @I.1 {
  483. // CHECK:STDOUT: %Self: %I.type.733 = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  484. // CHECK:STDOUT:
  485. // CHECK:STDOUT: !members:
  486. // CHECK:STDOUT: .Self = %Self
  487. // CHECK:STDOUT: witness = ()
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: interface @I.2 {
  491. // CHECK:STDOUT: %Self: %I.type.4da = bind_symbolic_name Self, 0 [symbolic = constants.%Self.f85]
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: !members:
  494. // CHECK:STDOUT: .Self = %Self
  495. // CHECK:STDOUT: witness = ()
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: fn @F1(%x.param_patt: %I.type.733);
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: --- fail_poison_namespace_without_usage.carbon
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: constants {
  503. // CHECK:STDOUT: %C: type = class_type @C [template]
  504. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  505. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  506. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  507. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT:
  510. // CHECK:STDOUT: file {
  511. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  512. // CHECK:STDOUT: .C = %C.decl
  513. // CHECK:STDOUT: .N = %N
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  516. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  517. // CHECK:STDOUT: .F1 = %F1.decl
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  520. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  521. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param0
  522. // CHECK:STDOUT: } {
  523. // CHECK:STDOUT: %x.param: %C = value_param runtime_param0
  524. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  525. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT: %C: <namespace> = namespace [template] {}
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: class @C {
  531. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  532. // CHECK:STDOUT: complete_type_witness = %complete_type
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: !members:
  535. // CHECK:STDOUT: .Self = constants.%C
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: fn @F1(%x.param_patt: %C);
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: --- fail_poison_member_without_usage.carbon
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: constants {
  543. // CHECK:STDOUT: %C1: type = class_type @C1 [template]
  544. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  545. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  546. // CHECK:STDOUT: %D: type = class_type @D [template]
  547. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  548. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  549. // CHECK:STDOUT: %C2: type = class_type @C2 [template]
  550. // CHECK:STDOUT: %D.elem: type = unbound_element_type %D, %C2 [template]
  551. // CHECK:STDOUT: %struct_type.C1: type = struct_type {.C1: %C2} [template]
  552. // CHECK:STDOUT: %complete_type.ec1: <witness> = complete_type_witness %struct_type.C1 [template]
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: file {
  556. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  557. // CHECK:STDOUT: .C1 = %C1.decl
  558. // CHECK:STDOUT: .D = %D.decl
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT: %C1.decl: type = class_decl @C1 [template = constants.%C1] {} {}
  561. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: class @C1 {
  565. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  566. // CHECK:STDOUT: complete_type_witness = %complete_type
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: !members:
  569. // CHECK:STDOUT: .Self = constants.%C1
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: class @D {
  573. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  574. // CHECK:STDOUT: %x.patt: %C1 = binding_pattern x
  575. // CHECK:STDOUT: %x.param_patt: %C1 = value_param_pattern %x.patt, runtime_param0
  576. // CHECK:STDOUT: } {
  577. // CHECK:STDOUT: %x.param: %C1 = value_param runtime_param0
  578. // CHECK:STDOUT: %C1.ref: type = name_ref C1, file.%C1.decl [template = constants.%C1]
  579. // CHECK:STDOUT: %x: %C1 = bind_name x, %x.param
  580. // CHECK:STDOUT: }
  581. // CHECK:STDOUT: %C2.decl: type = class_decl @C2 [template = constants.%C2] {} {}
  582. // CHECK:STDOUT: %.loc20_9: %D.elem = field_decl C1, element0 [template]
  583. // CHECK:STDOUT: name_binding_decl {
  584. // CHECK:STDOUT: %.loc20_3: %D.elem = var_pattern %.loc20_9
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT: %.var: ref %D.elem = var <none>
  587. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.C1 [template = constants.%complete_type.ec1]
  588. // CHECK:STDOUT: complete_type_witness = %complete_type
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: !members:
  591. // CHECK:STDOUT: .Self = constants.%D
  592. // CHECK:STDOUT: .F1 = %F1.decl
  593. // CHECK:STDOUT: .C2 = %C2.decl
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: class @C2 {
  597. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  598. // CHECK:STDOUT: complete_type_witness = %complete_type
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: !members:
  601. // CHECK:STDOUT: .Self = constants.%C2
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: fn @F1(%x.param_patt: %C1);
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: --- fail_poison_function_without_usage.carbon
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: constants {
  609. // CHECK:STDOUT: %C.f79: type = class_type @C.2 [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: %F1: %F1.type = struct_value () [template]
  614. // CHECK:STDOUT: %C.type: type = fn_type @C.1 [template]
  615. // CHECK:STDOUT: %C.3f2: %C.type = struct_value () [template]
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: file {
  619. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  620. // CHECK:STDOUT: .C = %C.decl.loc4
  621. // CHECK:STDOUT: .N = %N
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.2 [template = constants.%C.f79] {} {}
  624. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  625. // CHECK:STDOUT: .F1 = %F1.decl
  626. // CHECK:STDOUT: }
  627. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  628. // CHECK:STDOUT: %x.patt: %C.f79 = binding_pattern x
  629. // CHECK:STDOUT: %x.param_patt: %C.f79 = value_param_pattern %x.patt, runtime_param0
  630. // CHECK:STDOUT: } {
  631. // CHECK:STDOUT: %x.param: %C.f79 = value_param runtime_param0
  632. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc4 [template = constants.%C.f79]
  633. // CHECK:STDOUT: %x: %C.f79 = bind_name x, %x.param
  634. // CHECK:STDOUT: }
  635. // CHECK:STDOUT: %C.decl.loc19: %C.type = fn_decl @C.1 [template = constants.%C.3f2] {} {}
  636. // CHECK:STDOUT: }
  637. // CHECK:STDOUT:
  638. // CHECK:STDOUT: class @C.2 {
  639. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  640. // CHECK:STDOUT: complete_type_witness = %complete_type
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: !members:
  643. // CHECK:STDOUT: .Self = constants.%C.f79
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.f79);
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: fn @C.1();
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: --- fail_use_undefined_poisoned_name.carbon
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: constants {
  653. // CHECK:STDOUT: %C: type = class_type @C [template]
  654. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  655. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  656. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  657. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  658. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  659. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  660. // CHECK:STDOUT: }
  661. // CHECK:STDOUT:
  662. // CHECK:STDOUT: file {
  663. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  664. // CHECK:STDOUT: .C = %C.decl
  665. // CHECK:STDOUT: .N = %N
  666. // CHECK:STDOUT: }
  667. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  668. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  669. // CHECK:STDOUT: .F1 = %F1.decl
  670. // CHECK:STDOUT: .F2 = %F2.decl
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  673. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  674. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  675. // CHECK:STDOUT: } {
  676. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  677. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param0
  678. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  681. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern
  682. // CHECK:STDOUT: %return.param_patt: <error> = out_param_pattern %return.patt, runtime_param0
  683. // CHECK:STDOUT: } {
  684. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  685. // CHECK:STDOUT: %C.ref: <error> = name_ref C, <error> [template = <error>]
  686. // CHECK:STDOUT: %return.param: ref <error> = out_param runtime_param0
  687. // CHECK:STDOUT: %return: ref <error> = return_slot %return.param
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: class @C {
  692. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  693. // CHECK:STDOUT: complete_type_witness = %complete_type
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: !members:
  696. // CHECK:STDOUT: .Self = constants.%C
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: fn @F1() -> %C;
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: fn @F2() -> <error>;
  702. // CHECK:STDOUT:
  703. // CHECK:STDOUT: --- fail_poison_with_usage.carbon
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: constants {
  706. // CHECK:STDOUT: %C.f79: type = class_type @C.1 [template]
  707. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  708. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  709. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  710. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  711. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  712. // CHECK:STDOUT: %C.9f4: type = class_type @C.2 [template]
  713. // CHECK:STDOUT: %F2.type: type = fn_type @F2 [template]
  714. // CHECK:STDOUT: %F2: %F2.type = struct_value () [template]
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: file {
  718. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  719. // CHECK:STDOUT: .C = %C.decl.loc4
  720. // CHECK:STDOUT: .N = %N
  721. // CHECK:STDOUT: }
  722. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.1 [template = constants.%C.f79] {} {}
  723. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  724. // CHECK:STDOUT: .F1 = %F1.decl
  725. // CHECK:STDOUT: .F2 = %F2.decl
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  728. // CHECK:STDOUT: %x.patt: %C.f79 = binding_pattern x
  729. // CHECK:STDOUT: %x.param_patt: %C.f79 = value_param_pattern %x.patt, runtime_param0
  730. // CHECK:STDOUT: } {
  731. // CHECK:STDOUT: %x.param: %C.f79 = value_param runtime_param0
  732. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc4 [template = constants.%C.f79]
  733. // CHECK:STDOUT: %x: %C.f79 = bind_name x, %x.param
  734. // CHECK:STDOUT: }
  735. // CHECK:STDOUT: %C.decl.loc19: type = class_decl @C.2 [template = constants.%C.9f4] {} {}
  736. // CHECK:STDOUT: %F2.decl: %F2.type = fn_decl @F2 [template = constants.%F2] {
  737. // CHECK:STDOUT: %x.patt: %C.f79 = binding_pattern x
  738. // CHECK:STDOUT: %x.param_patt: %C.f79 = value_param_pattern %x.patt, runtime_param0
  739. // CHECK:STDOUT: } {
  740. // CHECK:STDOUT: %x.param: %C.f79 = value_param runtime_param0
  741. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc4 [template = constants.%C.f79]
  742. // CHECK:STDOUT: %x: %C.f79 = bind_name x, %x.param
  743. // CHECK:STDOUT: }
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: class @C.1 {
  747. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  748. // CHECK:STDOUT: complete_type_witness = %complete_type
  749. // CHECK:STDOUT:
  750. // CHECK:STDOUT: !members:
  751. // CHECK:STDOUT: .Self = constants.%C.f79
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: class @C.2 {
  755. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  756. // CHECK:STDOUT: complete_type_witness = %complete_type
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: !members:
  759. // CHECK:STDOUT: .Self = constants.%C.9f4
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.f79);
  763. // CHECK:STDOUT:
  764. // CHECK:STDOUT: fn @F2(%x.param_patt: %C.f79) {
  765. // CHECK:STDOUT: !entry:
  766. // CHECK:STDOUT: %N.ref: <namespace> = name_ref N, file.%N [template = file.%N]
  767. // CHECK:STDOUT: %F1.ref: %F1.type = name_ref F1, file.%F1.decl [template = constants.%F1]
  768. // CHECK:STDOUT: %x.ref: %C.f79 = name_ref x, %x
  769. // CHECK:STDOUT: %F1.call: init %empty_tuple.type = call %F1.ref(%x.ref)
  770. // CHECK:STDOUT: return
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT:
  773. // CHECK:STDOUT: --- fail_poison_multiple_scopes.carbon
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: constants {
  776. // CHECK:STDOUT: %C.f79: type = class_type @C.1 [template]
  777. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  778. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  779. // CHECK:STDOUT: %D1: type = class_type @D1 [template]
  780. // CHECK:STDOUT: %D2.type: type = facet_type <@D2> [template]
  781. // CHECK:STDOUT: %Self.8cf: %D2.type = bind_symbolic_name Self, 0 [symbolic]
  782. // CHECK:STDOUT: %D3.b65: type = class_type @D3 [template]
  783. // CHECK:STDOUT: %D3.68e: type = class_type @D3, @D3(%Self.8cf) [symbolic]
  784. // CHECK:STDOUT: %F.type: type = fn_type @F, @D3(%Self.8cf) [symbolic]
  785. // CHECK:STDOUT: %F: %F.type = struct_value () [symbolic]
  786. // CHECK:STDOUT: %C.fef: type = class_type @C.2 [template]
  787. // CHECK:STDOUT: %C.5a3: type = class_type @C.2, @C.2(%Self.8cf) [symbolic]
  788. // CHECK:STDOUT: %C.2fa: type = class_type @C.3 [template]
  789. // CHECK:STDOUT: %C.4bd: type = class_type @C.3, @C.3(%Self.8cf) [symbolic]
  790. // CHECK:STDOUT: %C.6f6: type = class_type @C.4 [template]
  791. // CHECK:STDOUT: %C.0b8: type = class_type @C.5 [template]
  792. // CHECK:STDOUT: %C.type: type = facet_type <@C.7> [template]
  793. // CHECK:STDOUT: %Self.b2a: %C.type = bind_symbolic_name Self, 0 [symbolic]
  794. // CHECK:STDOUT: %C.6f1: type = class_type @C.6 [template]
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT:
  797. // CHECK:STDOUT: file {
  798. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  799. // CHECK:STDOUT: .C = %C.decl.loc4
  800. // CHECK:STDOUT: .N1 = %N1
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT: %C.decl.loc4: type = class_decl @C.1 [template = constants.%C.f79] {} {}
  803. // CHECK:STDOUT: %N1: <namespace> = namespace [template] {
  804. // CHECK:STDOUT: .N2 = %N2
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT: %N2: <namespace> = namespace [template] {
  807. // CHECK:STDOUT: .N3 = %N3
  808. // CHECK:STDOUT: }
  809. // CHECK:STDOUT: %N3: <namespace> = namespace [template] {
  810. // CHECK:STDOUT: .D1 = %D1.decl
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT: %D1.decl: type = class_decl @D1 [template = constants.%D1] {} {}
  813. // CHECK:STDOUT: %C.decl.loc59: type = class_decl @C.5 [template = constants.%C.0b8] {} {}
  814. // CHECK:STDOUT: %C.decl.loc68: type = interface_decl @C.7 [template = constants.%C.type] {} {}
  815. // CHECK:STDOUT: %C.decl.loc74: type = class_decl @C.6 [template = constants.%C.6f1] {} {}
  816. // CHECK:STDOUT: }
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: interface @D2 {
  819. // CHECK:STDOUT: %Self: %D2.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.8cf]
  820. // CHECK:STDOUT: %D3.decl: type = class_decl @D3 [template = constants.%D3.b65] {} {}
  821. // CHECK:STDOUT: %C.decl: type = class_decl @C.3 [template = constants.%C.2fa] {} {}
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: !members:
  824. // CHECK:STDOUT: .Self = %Self
  825. // CHECK:STDOUT: .D3 = %D3.decl
  826. // CHECK:STDOUT: witness = ()
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: interface @C.7 {
  830. // CHECK:STDOUT: %Self: %C.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.b2a]
  831. // CHECK:STDOUT:
  832. // CHECK:STDOUT: !members:
  833. // CHECK:STDOUT: .Self = %Self
  834. // CHECK:STDOUT: witness = ()
  835. // CHECK:STDOUT: }
  836. // CHECK:STDOUT:
  837. // CHECK:STDOUT: class @C.1 {
  838. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  839. // CHECK:STDOUT: complete_type_witness = %complete_type
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: !members:
  842. // CHECK:STDOUT: .Self = constants.%C.f79
  843. // CHECK:STDOUT: }
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: class @D1 {
  846. // CHECK:STDOUT: %D2.decl: type = interface_decl @D2 [template = constants.%D2.type] {} {}
  847. // CHECK:STDOUT: %C.decl: type = class_decl @C.4 [template = constants.%C.6f6] {} {}
  848. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  849. // CHECK:STDOUT: complete_type_witness = %complete_type
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: !members:
  852. // CHECK:STDOUT: .Self = constants.%D1
  853. // CHECK:STDOUT: .D2 = %D2.decl
  854. // CHECK:STDOUT: }
  855. // CHECK:STDOUT:
  856. // CHECK:STDOUT: generic class @D3(@D2.%Self: %D2.type) {
  857. // CHECK:STDOUT: !definition:
  858. // CHECK:STDOUT: %Self: %D2.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.8cf)]
  859. // CHECK:STDOUT: %F.type: type = fn_type @F, @D3(%Self) [symbolic = %F.type (constants.%F.type)]
  860. // CHECK:STDOUT: %F: @D3.%F.type (%F.type) = struct_value () [symbolic = %F (constants.%F)]
  861. // CHECK:STDOUT:
  862. // CHECK:STDOUT: class {
  863. // CHECK:STDOUT: %F.decl: @D3.%F.type (%F.type) = fn_decl @F [symbolic = @D3.%F (constants.%F)] {
  864. // CHECK:STDOUT: %x.patt: %C.f79 = binding_pattern x
  865. // CHECK:STDOUT: %x.param_patt: %C.f79 = value_param_pattern %x.patt, runtime_param0
  866. // CHECK:STDOUT: } {
  867. // CHECK:STDOUT: %x.param: %C.f79 = value_param runtime_param0
  868. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl.loc4 [template = constants.%C.f79]
  869. // CHECK:STDOUT: %x: %C.f79 = bind_name x, %x.param
  870. // CHECK:STDOUT: }
  871. // CHECK:STDOUT: %C.decl: type = class_decl @C.2 [template = constants.%C.fef] {} {}
  872. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  873. // CHECK:STDOUT: complete_type_witness = %complete_type
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: !members:
  876. // CHECK:STDOUT: .Self = constants.%D3.68e
  877. // CHECK:STDOUT: .F = %F.decl
  878. // CHECK:STDOUT: }
  879. // CHECK:STDOUT: }
  880. // CHECK:STDOUT:
  881. // CHECK:STDOUT: generic class @C.2(@D2.%Self: %D2.type) {
  882. // CHECK:STDOUT: !definition:
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: class {
  885. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  886. // CHECK:STDOUT: complete_type_witness = %complete_type
  887. // CHECK:STDOUT:
  888. // CHECK:STDOUT: !members:
  889. // CHECK:STDOUT: .Self = constants.%C.5a3
  890. // CHECK:STDOUT: }
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: generic class @C.3(@D2.%Self: %D2.type) {
  894. // CHECK:STDOUT: !definition:
  895. // CHECK:STDOUT:
  896. // CHECK:STDOUT: class {
  897. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  898. // CHECK:STDOUT: complete_type_witness = %complete_type
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: !members:
  901. // CHECK:STDOUT: .Self = constants.%C.4bd
  902. // CHECK:STDOUT: }
  903. // CHECK:STDOUT: }
  904. // CHECK:STDOUT:
  905. // CHECK:STDOUT: class @C.4 {
  906. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  907. // CHECK:STDOUT: complete_type_witness = %complete_type
  908. // CHECK:STDOUT:
  909. // CHECK:STDOUT: !members:
  910. // CHECK:STDOUT: .Self = constants.%C.6f6
  911. // CHECK:STDOUT: }
  912. // CHECK:STDOUT:
  913. // CHECK:STDOUT: class @C.5 {
  914. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  915. // CHECK:STDOUT: complete_type_witness = %complete_type
  916. // CHECK:STDOUT:
  917. // CHECK:STDOUT: !members:
  918. // CHECK:STDOUT: .Self = constants.%C.0b8
  919. // CHECK:STDOUT: }
  920. // CHECK:STDOUT:
  921. // CHECK:STDOUT: class @C.6 {
  922. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  923. // CHECK:STDOUT: complete_type_witness = %complete_type
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: !members:
  926. // CHECK:STDOUT: .Self = constants.%C.6f1
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: generic fn @F(@D2.%Self: %D2.type) {
  930. // CHECK:STDOUT: fn(%x.param_patt: %C.f79);
  931. // CHECK:STDOUT: }
  932. // CHECK:STDOUT:
  933. // CHECK:STDOUT: specific @D3(constants.%Self.8cf) {}
  934. // CHECK:STDOUT:
  935. // CHECK:STDOUT: specific @F(constants.%Self.8cf) {}
  936. // CHECK:STDOUT:
  937. // CHECK:STDOUT: specific @C.2(constants.%Self.8cf) {}
  938. // CHECK:STDOUT:
  939. // CHECK:STDOUT: specific @D3(%Self) {}
  940. // CHECK:STDOUT:
  941. // CHECK:STDOUT: specific @C.3(constants.%Self.8cf) {}
  942. // CHECK:STDOUT:
  943. // CHECK:STDOUT: --- fail_alias.carbon
  944. // CHECK:STDOUT:
  945. // CHECK:STDOUT: constants {
  946. // CHECK:STDOUT: %C: type = class_type @C [template]
  947. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  948. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  949. // CHECK:STDOUT: }
  950. // CHECK:STDOUT:
  951. // CHECK:STDOUT: file {
  952. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  953. // CHECK:STDOUT: .C = %C.decl
  954. // CHECK:STDOUT: .N = %N
  955. // CHECK:STDOUT: }
  956. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  957. // CHECK:STDOUT: %N: <namespace> = namespace [template] {}
  958. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  959. // CHECK:STDOUT: %C: type = bind_alias C, %C.decl [template = constants.%C]
  960. // CHECK:STDOUT: }
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: class @C {
  963. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  964. // CHECK:STDOUT: complete_type_witness = %complete_type
  965. // CHECK:STDOUT:
  966. // CHECK:STDOUT: !members:
  967. // CHECK:STDOUT: .Self = constants.%C
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: --- ignored_poison_in_import.carbon
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: constants {
  973. // CHECK:STDOUT: %C: type = class_type @C [template]
  974. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  975. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  976. // CHECK:STDOUT: }
  977. // CHECK:STDOUT:
  978. // CHECK:STDOUT: imports {
  979. // CHECK:STDOUT: %Main.C = import_ref Main//poison, C, unloaded
  980. // CHECK:STDOUT: %Main.N: <namespace> = import_ref Main//poison, N, loaded
  981. // CHECK:STDOUT: %N: <namespace> = namespace %Main.N, [template] {
  982. // CHECK:STDOUT: .F1 = %Main.F1
  983. // CHECK:STDOUT: .C = file.%C.decl
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT: }
  986. // CHECK:STDOUT:
  987. // CHECK:STDOUT: file {
  988. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  989. // CHECK:STDOUT: .C = imports.%Main.C
  990. // CHECK:STDOUT: .N = imports.%N
  991. // CHECK:STDOUT: }
  992. // CHECK:STDOUT: %default.import = import <none>
  993. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  994. // CHECK:STDOUT: }
  995. // CHECK:STDOUT:
  996. // CHECK:STDOUT: class @C {
  997. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  998. // CHECK:STDOUT: complete_type_witness = %complete_type
  999. // CHECK:STDOUT:
  1000. // CHECK:STDOUT: !members:
  1001. // CHECK:STDOUT: .Self = constants.%C
  1002. // CHECK:STDOUT: }
  1003. // CHECK:STDOUT:
  1004. // CHECK:STDOUT: --- poison.impl.carbon
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: constants {
  1007. // CHECK:STDOUT: %C: type = class_type @C [template]
  1008. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1009. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT:
  1012. // CHECK:STDOUT: imports {
  1013. // CHECK:STDOUT: %Main.C = import_ref Main//poison, C, unloaded
  1014. // CHECK:STDOUT: %Main.N: <namespace> = import_ref Main//poison, N, loaded
  1015. // CHECK:STDOUT: %N: <namespace> = namespace %Main.N, [template] {
  1016. // CHECK:STDOUT: .F1 = %Main.F1
  1017. // CHECK:STDOUT: .C = file.%C.decl
  1018. // CHECK:STDOUT: }
  1019. // CHECK:STDOUT: }
  1020. // CHECK:STDOUT:
  1021. // CHECK:STDOUT: file {
  1022. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1023. // CHECK:STDOUT: .C = imports.%Main.C
  1024. // CHECK:STDOUT: .N = imports.%N
  1025. // CHECK:STDOUT: }
  1026. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  1027. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  1028. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  1029. // CHECK:STDOUT: }
  1030. // CHECK:STDOUT:
  1031. // CHECK:STDOUT: class @C {
  1032. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1033. // CHECK:STDOUT: complete_type_witness = %complete_type
  1034. // CHECK:STDOUT:
  1035. // CHECK:STDOUT: !members:
  1036. // CHECK:STDOUT: .Self = constants.%C
  1037. // CHECK:STDOUT: }
  1038. // CHECK:STDOUT:
  1039. // CHECK:STDOUT: --- using_poisoned_name_in_impl.carbon
  1040. // CHECK:STDOUT:
  1041. // CHECK:STDOUT: constants {
  1042. // CHECK:STDOUT: %C.type: type = facet_type <@C> [template]
  1043. // CHECK:STDOUT: %Self: %C.type = bind_symbolic_name Self, 0 [symbolic]
  1044. // CHECK:STDOUT: %F1.type: type = fn_type @F1 [template]
  1045. // CHECK:STDOUT: %F1: %F1.type = struct_value () [template]
  1046. // CHECK:STDOUT: %X: type = class_type @X [template]
  1047. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template]
  1048. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1049. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1050. // CHECK:STDOUT: }
  1051. // CHECK:STDOUT:
  1052. // CHECK:STDOUT: file {
  1053. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1054. // CHECK:STDOUT: .C = %C.decl
  1055. // CHECK:STDOUT: .N = %N
  1056. // CHECK:STDOUT: }
  1057. // CHECK:STDOUT: %C.decl: type = interface_decl @C [template = constants.%C.type] {} {}
  1058. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  1059. // CHECK:STDOUT: .F1 = %F1.decl
  1060. // CHECK:STDOUT: .X = %X.decl
  1061. // CHECK:STDOUT: }
  1062. // CHECK:STDOUT: %F1.decl: %F1.type = fn_decl @F1 [template = constants.%F1] {
  1063. // CHECK:STDOUT: %x.patt: %C.type = binding_pattern x
  1064. // CHECK:STDOUT: %x.param_patt: %C.type = value_param_pattern %x.patt, runtime_param0
  1065. // CHECK:STDOUT: } {
  1066. // CHECK:STDOUT: %x.param: %C.type = value_param runtime_param0
  1067. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C.type]
  1068. // CHECK:STDOUT: %x: %C.type = bind_name x, %x.param
  1069. // CHECK:STDOUT: }
  1070. // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} {}
  1071. // CHECK:STDOUT: }
  1072. // CHECK:STDOUT:
  1073. // CHECK:STDOUT: interface @C {
  1074. // CHECK:STDOUT: %Self: %C.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1075. // CHECK:STDOUT:
  1076. // CHECK:STDOUT: !members:
  1077. // CHECK:STDOUT: .Self = %Self
  1078. // CHECK:STDOUT: witness = ()
  1079. // CHECK:STDOUT: }
  1080. // CHECK:STDOUT:
  1081. // CHECK:STDOUT: impl @impl: %Self.ref as %C.ref {
  1082. // CHECK:STDOUT: !members:
  1083. // CHECK:STDOUT: witness = @X.%impl_witness
  1084. // CHECK:STDOUT: }
  1085. // CHECK:STDOUT:
  1086. // CHECK:STDOUT: class @X {
  1087. // CHECK:STDOUT: impl_decl @impl [template] {} {
  1088. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%X [template = constants.%X]
  1089. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C.type]
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template = constants.%impl_witness]
  1092. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1093. // CHECK:STDOUT: complete_type_witness = %complete_type
  1094. // CHECK:STDOUT:
  1095. // CHECK:STDOUT: !members:
  1096. // CHECK:STDOUT: .Self = constants.%X
  1097. // CHECK:STDOUT: extend @impl.%C.ref
  1098. // CHECK:STDOUT: }
  1099. // CHECK:STDOUT:
  1100. // CHECK:STDOUT: fn @F1(%x.param_patt: %C.type);
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: --- fail_using_poisoned_name_in_impl_outside_class.carbon
  1103. // CHECK:STDOUT:
  1104. // CHECK:STDOUT: constants {
  1105. // CHECK:STDOUT: %A.type: type = facet_type <@A> [template]
  1106. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic]
  1107. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  1108. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  1109. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type %A.type [template]
  1110. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.%B.decl [template]
  1111. // CHECK:STDOUT: %X: type = class_type @X [template]
  1112. // CHECK:STDOUT: }
  1113. // CHECK:STDOUT:
  1114. // CHECK:STDOUT: file {}
  1115. // CHECK:STDOUT:
  1116. // CHECK:STDOUT: interface @A {
  1117. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  1118. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {}
  1119. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, %B.decl [template = constants.%assoc0]
  1120. // CHECK:STDOUT:
  1121. // CHECK:STDOUT: !members:
  1122. // CHECK:STDOUT: .Self = %Self
  1123. // CHECK:STDOUT: .B = %assoc0
  1124. // CHECK:STDOUT: witness = (%B.decl)
  1125. // CHECK:STDOUT: }
  1126. // CHECK:STDOUT:
  1127. // CHECK:STDOUT: impl @impl: <unexpected>.inst26.loc8_15 as <unexpected>.inst27.loc8_18;
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: class @X {
  1130. // CHECK:STDOUT: complete_type_witness = invalid
  1131. // CHECK:STDOUT:
  1132. // CHECK:STDOUT: !members:
  1133. // CHECK:STDOUT: .Self = constants.%X
  1134. // CHECK:STDOUT: extend <unexpected>.inst27.loc8_18
  1135. // CHECK:STDOUT: }
  1136. // CHECK:STDOUT:
  1137. // CHECK:STDOUT: generic fn @B(@A.%Self: %A.type) {
  1138. // CHECK:STDOUT: fn();
  1139. // CHECK:STDOUT: }
  1140. // CHECK:STDOUT:
  1141. // CHECK:STDOUT: fn @F();
  1142. // CHECK:STDOUT:
  1143. // CHECK:STDOUT: specific @B(constants.%Self) {}
  1144. // CHECK:STDOUT:
  1145. // CHECK:STDOUT: --- fail_poison_when_lookup_fails.carbon
  1146. // CHECK:STDOUT:
  1147. // CHECK:STDOUT: constants {
  1148. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  1149. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  1150. // CHECK:STDOUT: %C.f79: type = class_type @C.1 [template]
  1151. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1152. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  1153. // CHECK:STDOUT: %C.9f4: type = class_type @C.2 [template]
  1154. // CHECK:STDOUT: }
  1155. // CHECK:STDOUT:
  1156. // CHECK:STDOUT: file {
  1157. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1158. // CHECK:STDOUT: .N = %N
  1159. // CHECK:STDOUT: }
  1160. // CHECK:STDOUT: %N: <namespace> = namespace [template] {
  1161. // CHECK:STDOUT: .F = %F.decl
  1162. // CHECK:STDOUT: }
  1163. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  1164. // CHECK:STDOUT: %x.patt: <error> = binding_pattern x
  1165. // CHECK:STDOUT: %x.param_patt: <error> = value_param_pattern %x.patt, runtime_param0
  1166. // CHECK:STDOUT: } {
  1167. // CHECK:STDOUT: %x.param: <error> = value_param runtime_param0
  1168. // CHECK:STDOUT: %C.ref: <error> = name_ref C, <error> [template = <error>]
  1169. // CHECK:STDOUT: %x: <error> = bind_name x, %x.param
  1170. // CHECK:STDOUT: }
  1171. // CHECK:STDOUT: %C.decl.loc22: type = class_decl @C.1 [template = constants.%C.f79] {} {}
  1172. // CHECK:STDOUT: %C.decl.loc27: type = class_decl @C.2 [template = constants.%C.9f4] {} {}
  1173. // CHECK:STDOUT: }
  1174. // CHECK:STDOUT:
  1175. // CHECK:STDOUT: class @C.1 {
  1176. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1177. // CHECK:STDOUT: complete_type_witness = %complete_type
  1178. // CHECK:STDOUT:
  1179. // CHECK:STDOUT: !members:
  1180. // CHECK:STDOUT: .Self = constants.%C.f79
  1181. // CHECK:STDOUT: }
  1182. // CHECK:STDOUT:
  1183. // CHECK:STDOUT: class @C.2 {
  1184. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  1185. // CHECK:STDOUT: complete_type_witness = %complete_type
  1186. // CHECK:STDOUT:
  1187. // CHECK:STDOUT: !members:
  1188. // CHECK:STDOUT: .Self = constants.%C.9f4
  1189. // CHECK:STDOUT: }
  1190. // CHECK:STDOUT:
  1191. // CHECK:STDOUT: fn @F(%x.param_patt: <error>);
  1192. // CHECK:STDOUT:
  1193. // CHECK:STDOUT: --- fail_poison_with_lexical_result.carbon
  1194. // CHECK:STDOUT:
  1195. // CHECK:STDOUT: constants {
  1196. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  1197. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  1198. // CHECK:STDOUT: %A.666: type = class_type @A.1 [template]
  1199. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  1200. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  1201. // CHECK:STDOUT: %B: type = class_type @B [template]
  1202. // CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A.666 [template]
  1203. // CHECK:STDOUT: %A.9b6: type = class_type @A.2 [template]
  1204. // CHECK:STDOUT: %struct_type.v: type = struct_type {.v: %A.666} [template]
  1205. // CHECK:STDOUT: %complete_type.57e: <witness> = complete_type_witness %struct_type.v [template]
  1206. // CHECK:STDOUT: }
  1207. // CHECK:STDOUT:
  1208. // CHECK:STDOUT: file {
  1209. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1210. // CHECK:STDOUT: .F = %F.decl
  1211. // CHECK:STDOUT: }
  1212. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  1213. // CHECK:STDOUT: }
  1214. // CHECK:STDOUT:
  1215. // CHECK:STDOUT: class @A.1 {
  1216. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  1217. // CHECK:STDOUT: complete_type_witness = %complete_type
  1218. // CHECK:STDOUT:
  1219. // CHECK:STDOUT: !members:
  1220. // CHECK:STDOUT: .Self = constants.%A.666
  1221. // CHECK:STDOUT: }
  1222. // CHECK:STDOUT:
  1223. // CHECK:STDOUT: class @B {
  1224. // CHECK:STDOUT: %.loc11_10: %B.elem = field_decl v, element0 [template]
  1225. // CHECK:STDOUT: name_binding_decl {
  1226. // CHECK:STDOUT: %.loc11_5: %B.elem = var_pattern %.loc11_10
  1227. // CHECK:STDOUT: }
  1228. // CHECK:STDOUT: %.var: ref %B.elem = var <none>
  1229. // CHECK:STDOUT: %A.decl: type = class_decl @A.2 [template = constants.%A.9b6] {} {}
  1230. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.v [template = constants.%complete_type.57e]
  1231. // CHECK:STDOUT: complete_type_witness = %complete_type
  1232. // CHECK:STDOUT:
  1233. // CHECK:STDOUT: !members:
  1234. // CHECK:STDOUT: .Self = constants.%B
  1235. // CHECK:STDOUT: .v = %.loc11_10
  1236. // CHECK:STDOUT: }
  1237. // CHECK:STDOUT:
  1238. // CHECK:STDOUT: class @A.2 {
  1239. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  1240. // CHECK:STDOUT: complete_type_witness = %complete_type
  1241. // CHECK:STDOUT:
  1242. // CHECK:STDOUT: !members:
  1243. // CHECK:STDOUT: .Self = constants.%A.9b6
  1244. // CHECK:STDOUT: }
  1245. // CHECK:STDOUT:
  1246. // CHECK:STDOUT: fn @F() {
  1247. // CHECK:STDOUT: !entry:
  1248. // CHECK:STDOUT: %A.decl: type = class_decl @A.1 [template = constants.%A.666] {} {}
  1249. // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} {}
  1250. // CHECK:STDOUT: return
  1251. // CHECK:STDOUT: }
  1252. // CHECK:STDOUT: