element_access.carbon 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuple/element_access.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/element_access.carbon
  12. // --- basics.carbon
  13. library "[[@TEST_NAME]]";
  14. var a: (i32,) = (42,);
  15. var b: (i32,) = a;
  16. //@dump-sem-ir-begin
  17. var c: i32 = b.0;
  18. //@dump-sem-ir-end
  19. // --- index_not_literal.carbon
  20. library "[[@TEST_NAME]]";
  21. var a: ((), i32) = ((), 34);
  22. //@dump-sem-ir-begin
  23. var b: i32 = a.({.index = 1}.index);
  24. var c: () = a.(0 as i32);
  25. var d: i32 = a.({.index = 1 as i32}.index);
  26. //@dump-sem-ir-end
  27. // --- interface_member.carbon
  28. library "[[@TEST_NAME]]";
  29. interface I {
  30. fn F[self: Self]();
  31. }
  32. impl (i32, i32) as I {
  33. fn F[unused self: Self]() {}
  34. }
  35. fn G(x: (i32, i32)) {
  36. x.(I.F)();
  37. }
  38. // --- impl_thunk.carbon
  39. library "[[@TEST_NAME]]";
  40. base class Base {}
  41. class Derived { extend base: Base; }
  42. interface I {
  43. fn F[self: Self]() -> Base*;
  44. }
  45. var d: Derived;
  46. impl (i32, i32) as I {
  47. // This requires a thunk due to the return type mismatch.
  48. // The thunk internally contains an element access of the form
  49. // `self.(RealF)()`.
  50. fn F[unused self: Self]() -> Derived* { return &d; }
  51. }
  52. fn G(x: (i32, i32)) {
  53. x.(I.F)();
  54. }
  55. // --- class_member.carbon
  56. library "[[@TEST_NAME]]";
  57. class C {
  58. fn F[self: (i32, i32)]();
  59. }
  60. fn G(x: (i32, i32)) {
  61. x.(C.F)();
  62. }
  63. // --- return_value_access.carbon
  64. library "[[@TEST_NAME]]";
  65. fn F() -> (i32,) { return (0,); }
  66. fn Run() -> i32 {
  67. //@dump-sem-ir-begin
  68. return F().0;
  69. //@dump-sem-ir-end
  70. }
  71. // --- fail_access_error.carbon
  72. library "[[@TEST_NAME]]";
  73. var a: (i32, i32) = (12, 6);
  74. // CHECK:STDERR: fail_access_error.carbon:[[@LINE+4]]:17: error: name `oops` not found [NameNotFound]
  75. // CHECK:STDERR: var b: i32 = a.(oops);
  76. // CHECK:STDERR: ^~~~
  77. // CHECK:STDERR:
  78. var b: i32 = a.(oops);
  79. // --- fail_empty_access.carbon
  80. library "[[@TEST_NAME]]";
  81. fn F() {}
  82. fn Run() {
  83. // CHECK:STDERR: fail_empty_access.carbon:[[@LINE+4]]:3: error: tuple element index `0` is past the end of type `()` [TupleIndexOutOfBounds]
  84. // CHECK:STDERR: F().0;
  85. // CHECK:STDERR: ^~~~~
  86. // CHECK:STDERR:
  87. F().0;
  88. }
  89. // --- fail_large_index.carbon
  90. library "[[@TEST_NAME]]";
  91. var a: (i32,) = (12,);
  92. var b: (i32,) = a;
  93. // CHECK:STDERR: fail_large_index.carbon:[[@LINE+4]]:14: error: tuple element index `1` is past the end of type `(i32,)` [TupleIndexOutOfBounds]
  94. // CHECK:STDERR: var c: i32 = b.1;
  95. // CHECK:STDERR: ^~~
  96. // CHECK:STDERR:
  97. var c: i32 = b.1;
  98. // CHECK:STDERR: fail_large_index.carbon:[[@LINE+4]]:14: error: tuple element index `2147483647` is past the end of type `(i32,)` [TupleIndexOutOfBounds]
  99. // CHECK:STDERR: var d: i32 = b.(0x7FFF_FFFF);
  100. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  101. // CHECK:STDERR:
  102. var d: i32 = b.(0x7FFF_FFFF);
  103. // --- fail_negative_indexing.carbon
  104. library "[[@TEST_NAME]]";
  105. var a: (i32, i32) = (12, 6);
  106. // CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+4]]:14: error: tuple element index `-10` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds]
  107. // CHECK:STDERR: var b: i32 = a.(-10);
  108. // CHECK:STDERR: ^~~~~~~
  109. // CHECK:STDERR:
  110. var b: i32 = a.(-10);
  111. // --- fail_non_deterministic_type.carbon
  112. library "[[@TEST_NAME]]";
  113. var a: (i32, i32) = (2, 3);
  114. var b: i32 = 0;
  115. // CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+11]]:17: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
  116. // CHECK:STDERR: var c: i32 = a.(b);
  117. // CHECK:STDERR: ^
  118. // CHECK:STDERR: min_prelude/parts/int.carbon:27:3: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
  119. // CHECK:STDERR: fn Convert[self: Self]() -> IntLiteral() = "int.convert_checked";
  120. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. // CHECK:STDERR:
  122. // CHECK:STDERR: fail_non_deterministic_type.carbon:[[@LINE+4]]:14: error: tuple index must be a constant [TupleIndexNotConstant]
  123. // CHECK:STDERR: var c: i32 = a.(b);
  124. // CHECK:STDERR: ^~~~~
  125. // CHECK:STDERR:
  126. var c: i32 = a.(b);
  127. // --- fail_non_int_indexing.carbon
  128. library "[[@TEST_NAME]]";
  129. var a: (i32, i32) = (12, 6);
  130. // CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+7]]:17: error: cannot implicitly convert expression of type `Core.FloatLiteral` to `Core.IntLiteral` [ConversionFailure]
  131. // CHECK:STDERR: var b: i32 = a.(2.6);
  132. // CHECK:STDERR: ^~~
  133. // CHECK:STDERR: fail_non_int_indexing.carbon:[[@LINE+4]]:17: note: type `Core.FloatLiteral` does not implement interface `Core.ImplicitAs(Core.IntLiteral)` [MissingImplInMemberAccessNote]
  134. // CHECK:STDERR: var b: i32 = a.(2.6);
  135. // CHECK:STDERR: ^~~
  136. // CHECK:STDERR:
  137. var b: i32 = a.(2.6);
  138. // --- fail_non_tuple_access.carbon
  139. library "[[@TEST_NAME]]";
  140. fn Main() {
  141. var non_tuple: array(i32, 2) = (5, 5);
  142. // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+4]]:27: error: type `array(i32, 2)` does not support tuple indexing; only tuples can be indexed that way [TupleIndexOnANonTupleType]
  143. // CHECK:STDERR: var unused first: i32 = non_tuple.0;
  144. // CHECK:STDERR: ^~~~~~~~~~~
  145. // CHECK:STDERR:
  146. var unused first: i32 = non_tuple.0;
  147. }
  148. // --- fail_out_of_bound_access.carbon
  149. library "[[@TEST_NAME]]";
  150. var a: (i32, i32) = (12, 6);
  151. // CHECK:STDERR: fail_out_of_bound_access.carbon:[[@LINE+4]]:14: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds]
  152. // CHECK:STDERR: var b: i32 = a.2;
  153. // CHECK:STDERR: ^~~
  154. // CHECK:STDERR:
  155. var b: i32 = a.2;
  156. // --- fail_out_of_bound_not_literal.carbon
  157. library "[[@TEST_NAME]]";
  158. var a: (i32, i32) = (12, 34);
  159. // CHECK:STDERR: fail_out_of_bound_not_literal.carbon:[[@LINE+4]]:14: error: tuple element index `2` is past the end of type `(i32, i32)` [TupleIndexOutOfBounds]
  160. // CHECK:STDERR: var b: i32 = a.({.index = 2}.index);
  161. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
  162. // CHECK:STDERR:
  163. var b: i32 = a.({.index = 2}.index);
  164. // CHECK:STDOUT: --- basics.carbon
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: constants {
  167. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  168. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  169. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  170. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  171. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  172. // CHECK:STDOUT: %tuple.elem0.aa1: ref %i32 = tuple_access file.%b.var, element0 [concrete]
  173. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  174. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  175. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  176. // CHECK:STDOUT: %Copy.impl_witness.f17: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_32) [concrete]
  177. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.546: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  178. // CHECK:STDOUT: %Int.as.Copy.impl.Op.664: %Int.as.Copy.impl.Op.type.546 = struct_value () [concrete]
  179. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.f17) [concrete]
  180. // CHECK:STDOUT: %Copy.WithSelf.Op.type.081: type = fn_type @Copy.WithSelf.Op, @Copy(%Copy.facet) [concrete]
  181. // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %Copy.WithSelf.Op.type.081, %Copy.facet [concrete]
  182. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.664, @Int.as.Copy.impl.Op(%int_32) [concrete]
  183. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete]
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: imports {
  187. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  188. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: file {
  192. // CHECK:STDOUT: name_binding_decl {
  193. // CHECK:STDOUT: %c.patt: %pattern_type.7ce = ref_binding_pattern c [concrete]
  194. // CHECK:STDOUT: %c.var_patt: %pattern_type.7ce = var_pattern %c.patt [concrete]
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT: %c.var: ref %i32 = var %c.var_patt [concrete]
  197. // CHECK:STDOUT: %.loc6: type = splice_block %i32.loc6 [concrete = constants.%i32] {
  198. // CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  199. // CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: %c: ref %i32 = ref_binding c, %c.var [concrete = %c.var]
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: fn @__global_init() {
  205. // CHECK:STDOUT: !entry:
  206. // CHECK:STDOUT: <elided>
  207. // CHECK:STDOUT: %b.ref: ref %tuple.type.a1c = name_ref b, file.%b [concrete = file.%b.var]
  208. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0]
  209. // CHECK:STDOUT: %tuple.elem0.loc6: ref %i32 = tuple_access %b.ref, element0 [concrete = constants.%tuple.elem0.aa1]
  210. // CHECK:STDOUT: %.loc6: %i32 = acquire_value %tuple.elem0.loc6
  211. // CHECK:STDOUT: %impl.elem0.loc6: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664]
  212. // CHECK:STDOUT: %bound_method.loc6_15.1: <bound method> = bound_method %.loc6, %impl.elem0.loc6
  213. // CHECK:STDOUT: %specific_fn.loc6: <specific function> = specific_function %impl.elem0.loc6, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  214. // CHECK:STDOUT: %bound_method.loc6_15.2: <bound method> = bound_method %.loc6, %specific_fn.loc6
  215. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc6: init %i32 = call %bound_method.loc6_15.2(%.loc6)
  216. // CHECK:STDOUT: assign file.%c.var, %Int.as.Copy.impl.Op.call.loc6
  217. // CHECK:STDOUT: <elided>
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: --- index_not_literal.carbon
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: constants {
  223. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  224. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  225. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  226. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  227. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  228. // CHECK:STDOUT: %tuple.type.0ce: type = tuple_type (%empty_tuple.type, %i32) [concrete]
  229. // CHECK:STDOUT: %tuple.elem0: ref %empty_tuple.type = tuple_access file.%a.var, element0 [concrete]
  230. // CHECK:STDOUT: %tuple.elem1: ref %i32 = tuple_access file.%a.var, element1 [concrete]
  231. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  232. // CHECK:STDOUT: %ImplicitAs.type.139: type = facet_type <@ImplicitAs, @ImplicitAs(Core.IntLiteral)> [concrete]
  233. // CHECK:STDOUT: %From: Core.IntLiteral = symbolic_binding From, 0 [symbolic]
  234. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.2ed: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%From) [symbolic]
  235. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.d29: %Int.as.ImplicitAs.impl.Convert.type.2ed = struct_value () [symbolic]
  236. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  237. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  238. // CHECK:STDOUT: %struct_type.index.b1b: type = struct_type {.index: Core.IntLiteral} [concrete]
  239. // CHECK:STDOUT: %struct.972: %struct_type.index.b1b = struct_value (%int_1.5b8) [concrete]
  240. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  241. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  242. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  243. // CHECK:STDOUT: %Copy.impl_witness.f17: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_32) [concrete]
  244. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.546: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  245. // CHECK:STDOUT: %Int.as.Copy.impl.Op.664: %Int.as.Copy.impl.Op.type.546 = struct_value () [concrete]
  246. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.f17) [concrete]
  247. // CHECK:STDOUT: %Copy.WithSelf.Op.type.081: type = fn_type @Copy.WithSelf.Op, @Copy(%Copy.facet) [concrete]
  248. // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %Copy.WithSelf.Op.type.081, %Copy.facet [concrete]
  249. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.664, @Int.as.Copy.impl.Op(%int_32) [concrete]
  250. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  251. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  252. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  253. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  254. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  255. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  256. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  257. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  258. // CHECK:STDOUT: %As.facet: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  259. // CHECK:STDOUT: %As.WithSelf.Convert.type.e5b: type = fn_type @As.WithSelf.Convert, @As(%i32, %As.facet) [concrete]
  260. // CHECK:STDOUT: %.9ed: type = fn_type_with_self_type %As.WithSelf.Convert.type.e5b, %As.facet [concrete]
  261. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.5ad: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  262. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  263. // CHECK:STDOUT: %bound_method.628: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  264. // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
  265. // CHECK:STDOUT: %ImplicitAs.impl_witness.640: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.ea2, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  266. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.type.240: type = fn_type @Int.as.ImplicitAs.impl.Convert, @Int.as.ImplicitAs.impl(%int_32) [concrete]
  267. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.dd4: %Int.as.ImplicitAs.impl.Convert.type.240 = struct_value () [concrete]
  268. // CHECK:STDOUT: %ImplicitAs.facet.290: %ImplicitAs.type.139 = facet_value %i32, (%ImplicitAs.impl_witness.640) [concrete]
  269. // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.462: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs(Core.IntLiteral, %ImplicitAs.facet.290) [concrete]
  270. // CHECK:STDOUT: %.0a7: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.462, %ImplicitAs.facet.290 [concrete]
  271. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound.564: <bound method> = bound_method %int_0.6a9, %Int.as.ImplicitAs.impl.Convert.dd4 [concrete]
  272. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Int.as.ImplicitAs.impl.Convert.dd4, @Int.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  273. // CHECK:STDOUT: %bound_method.77d: <bound method> = bound_method %int_0.6a9, %Int.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  274. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.bd3: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  275. // CHECK:STDOUT: %bound_method.290: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  276. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  277. // CHECK:STDOUT: %struct_type.index.6ea: type = struct_type {.index: %i32} [concrete]
  278. // CHECK:STDOUT: %struct.63a: %struct_type.index.6ea = struct_value (%int_1.5d2) [concrete]
  279. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.bound.f7c: <bound method> = bound_method %int_1.5d2, %Int.as.ImplicitAs.impl.Convert.dd4 [concrete]
  280. // CHECK:STDOUT: %bound_method.04c: <bound method> = bound_method %int_1.5d2, %Int.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: imports {
  284. // CHECK:STDOUT: %Core.import_ref.0bc: @Int.as.ImplicitAs.impl.%Int.as.ImplicitAs.impl.Convert.type (%Int.as.ImplicitAs.impl.Convert.type.2ed) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.ImplicitAs.impl.%Int.as.ImplicitAs.impl.Convert (constants.%Int.as.ImplicitAs.impl.Convert.d29)]
  285. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.ea2 = impl_witness_table (%Core.import_ref.0bc), @Int.as.ImplicitAs.impl [concrete]
  286. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  287. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  288. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  289. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: file {
  293. // CHECK:STDOUT: name_binding_decl {
  294. // CHECK:STDOUT: %b.patt: %pattern_type.7ce = ref_binding_pattern b [concrete]
  295. // CHECK:STDOUT: %b.var_patt: %pattern_type.7ce = var_pattern %b.patt [concrete]
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT: %b.var: ref %i32 = var %b.var_patt [concrete]
  298. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5 [concrete = constants.%i32] {
  299. // CHECK:STDOUT: %int_32.loc5: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  300. // CHECK:STDOUT: %i32.loc5: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: %b: ref %i32 = ref_binding b, %b.var [concrete = %b.var]
  303. // CHECK:STDOUT: name_binding_decl {
  304. // CHECK:STDOUT: %c.patt: %pattern_type.cb1 = ref_binding_pattern c [concrete]
  305. // CHECK:STDOUT: %c.var_patt: %pattern_type.cb1 = var_pattern %c.patt [concrete]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT: %c.var: ref %empty_tuple.type = var %c.var_patt [concrete]
  308. // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [concrete = constants.%empty_tuple.type] {
  309. // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  310. // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %c: ref %empty_tuple.type = ref_binding c, %c.var [concrete = %c.var]
  313. // CHECK:STDOUT: name_binding_decl {
  314. // CHECK:STDOUT: %d.patt: %pattern_type.7ce = ref_binding_pattern d [concrete]
  315. // CHECK:STDOUT: %d.var_patt: %pattern_type.7ce = var_pattern %d.patt [concrete]
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT: %d.var: ref %i32 = var %d.var_patt [concrete]
  318. // CHECK:STDOUT: %.loc7: type = splice_block %i32.loc7 [concrete = constants.%i32] {
  319. // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  320. // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT: %d: ref %i32 = ref_binding d, %d.var [concrete = %d.var]
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: fn @__global_init() {
  326. // CHECK:STDOUT: !entry:
  327. // CHECK:STDOUT: <elided>
  328. // CHECK:STDOUT: %a.ref.loc5: ref %tuple.type.0ce = name_ref a, file.%a [concrete = file.%a.var]
  329. // CHECK:STDOUT: %int_1.loc5: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  330. // CHECK:STDOUT: %.loc5_28.1: %struct_type.index.b1b = struct_literal (%int_1.loc5) [concrete = constants.%struct.972]
  331. // CHECK:STDOUT: %struct.loc5: %struct_type.index.b1b = struct_value (%int_1.loc5) [concrete = constants.%struct.972]
  332. // CHECK:STDOUT: %.loc5_28.2: %struct_type.index.b1b = converted %.loc5_28.1, %struct.loc5 [concrete = constants.%struct.972]
  333. // CHECK:STDOUT: %.loc5_29: Core.IntLiteral = struct_access %.loc5_28.2, element0 [concrete = constants.%int_1.5b8]
  334. // CHECK:STDOUT: %tuple.elem1.loc5: ref %i32 = tuple_access %a.ref.loc5, element1 [concrete = constants.%tuple.elem1]
  335. // CHECK:STDOUT: %.loc5_15: %i32 = acquire_value %tuple.elem1.loc5
  336. // CHECK:STDOUT: %impl.elem0.loc5: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664]
  337. // CHECK:STDOUT: %bound_method.loc5_15.1: <bound method> = bound_method %.loc5_15, %impl.elem0.loc5
  338. // CHECK:STDOUT: %specific_fn.loc5: <specific function> = specific_function %impl.elem0.loc5, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  339. // CHECK:STDOUT: %bound_method.loc5_15.2: <bound method> = bound_method %.loc5_15, %specific_fn.loc5
  340. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc5: init %i32 = call %bound_method.loc5_15.2(%.loc5_15)
  341. // CHECK:STDOUT: assign file.%b.var, %Int.as.Copy.impl.Op.call.loc5
  342. // CHECK:STDOUT: %a.ref.loc6: ref %tuple.type.0ce = name_ref a, file.%a [concrete = file.%a.var]
  343. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  344. // CHECK:STDOUT: %int_32.loc6: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  345. // CHECK:STDOUT: %i32.loc6: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  346. // CHECK:STDOUT: %impl.elem0.loc6_18.1: %.9ed = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  347. // CHECK:STDOUT: %bound_method.loc6_18.1: <bound method> = bound_method %int_0, %impl.elem0.loc6_18.1 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.5ad]
  348. // CHECK:STDOUT: %specific_fn.loc6_18.1: <specific function> = specific_function %impl.elem0.loc6_18.1, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  349. // CHECK:STDOUT: %bound_method.loc6_18.2: <bound method> = bound_method %int_0, %specific_fn.loc6_18.1 [concrete = constants.%bound_method.628]
  350. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc6: init %i32 = call %bound_method.loc6_18.2(%int_0) [concrete = constants.%int_0.6a9]
  351. // CHECK:STDOUT: %.loc6_18.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc6 [concrete = constants.%int_0.6a9]
  352. // CHECK:STDOUT: %.loc6_18.2: %i32 = converted %int_0, %.loc6_18.1 [concrete = constants.%int_0.6a9]
  353. // CHECK:STDOUT: %impl.elem0.loc6_18.2: %.0a7 = impl_witness_access constants.%ImplicitAs.impl_witness.640, element0 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.dd4]
  354. // CHECK:STDOUT: %bound_method.loc6_18.3: <bound method> = bound_method %.loc6_18.2, %impl.elem0.loc6_18.2 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.bound.564]
  355. // CHECK:STDOUT: %specific_fn.loc6_18.2: <specific function> = specific_function %impl.elem0.loc6_18.2, @Int.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Int.as.ImplicitAs.impl.Convert.specific_fn]
  356. // CHECK:STDOUT: %bound_method.loc6_18.4: <bound method> = bound_method %.loc6_18.2, %specific_fn.loc6_18.2 [concrete = constants.%bound_method.77d]
  357. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc6: init Core.IntLiteral = call %bound_method.loc6_18.4(%.loc6_18.2) [concrete = constants.%int_0.5c6]
  358. // CHECK:STDOUT: %.loc6_18.3: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call.loc6 [concrete = constants.%int_0.5c6]
  359. // CHECK:STDOUT: %.loc6_18.4: Core.IntLiteral = converted %.loc6_18.2, %.loc6_18.3 [concrete = constants.%int_0.5c6]
  360. // CHECK:STDOUT: %tuple.elem0.loc6: ref %empty_tuple.type = tuple_access %a.ref.loc6, element0 [concrete = constants.%tuple.elem0]
  361. // CHECK:STDOUT: %.loc6_14: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  362. // CHECK:STDOUT: %.loc6_1: init %empty_tuple.type = converted %tuple.elem0.loc6, %.loc6_14 [concrete = constants.%empty_tuple]
  363. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  364. // CHECK:STDOUT: %a.ref.loc7: ref %tuple.type.0ce = name_ref a, file.%a [concrete = file.%a.var]
  365. // CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  366. // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  367. // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  368. // CHECK:STDOUT: %impl.elem0.loc7_29: %.9ed = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  369. // CHECK:STDOUT: %bound_method.loc7_29.1: <bound method> = bound_method %int_1.loc7, %impl.elem0.loc7_29 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.bd3]
  370. // CHECK:STDOUT: %specific_fn.loc7_29: <specific function> = specific_function %impl.elem0.loc7_29, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  371. // CHECK:STDOUT: %bound_method.loc7_29.2: <bound method> = bound_method %int_1.loc7, %specific_fn.loc7_29 [concrete = constants.%bound_method.290]
  372. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_29.2(%int_1.loc7) [concrete = constants.%int_1.5d2]
  373. // CHECK:STDOUT: %.loc7_29.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc7 [concrete = constants.%int_1.5d2]
  374. // CHECK:STDOUT: %.loc7_29.2: %i32 = converted %int_1.loc7, %.loc7_29.1 [concrete = constants.%int_1.5d2]
  375. // CHECK:STDOUT: %.loc7_35.1: %struct_type.index.6ea = struct_literal (%.loc7_29.2) [concrete = constants.%struct.63a]
  376. // CHECK:STDOUT: %struct.loc7: %struct_type.index.6ea = struct_value (%.loc7_29.2) [concrete = constants.%struct.63a]
  377. // CHECK:STDOUT: %.loc7_35.2: %struct_type.index.6ea = converted %.loc7_35.1, %struct.loc7 [concrete = constants.%struct.63a]
  378. // CHECK:STDOUT: %.loc7_36.1: %i32 = struct_access %.loc7_35.2, element0 [concrete = constants.%int_1.5d2]
  379. // CHECK:STDOUT: %impl.elem0.loc7_36: %.0a7 = impl_witness_access constants.%ImplicitAs.impl_witness.640, element0 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.dd4]
  380. // CHECK:STDOUT: %bound_method.loc7_36.1: <bound method> = bound_method %.loc7_36.1, %impl.elem0.loc7_36 [concrete = constants.%Int.as.ImplicitAs.impl.Convert.bound.f7c]
  381. // CHECK:STDOUT: %specific_fn.loc7_36: <specific function> = specific_function %impl.elem0.loc7_36, @Int.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Int.as.ImplicitAs.impl.Convert.specific_fn]
  382. // CHECK:STDOUT: %bound_method.loc7_36.2: <bound method> = bound_method %.loc7_36.1, %specific_fn.loc7_36 [concrete = constants.%bound_method.04c]
  383. // CHECK:STDOUT: %Int.as.ImplicitAs.impl.Convert.call.loc7: init Core.IntLiteral = call %bound_method.loc7_36.2(%.loc7_36.1) [concrete = constants.%int_1.5b8]
  384. // CHECK:STDOUT: %.loc7_36.2: Core.IntLiteral = value_of_initializer %Int.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_1.5b8]
  385. // CHECK:STDOUT: %.loc7_36.3: Core.IntLiteral = converted %.loc7_36.1, %.loc7_36.2 [concrete = constants.%int_1.5b8]
  386. // CHECK:STDOUT: %tuple.elem1.loc7: ref %i32 = tuple_access %a.ref.loc7, element1 [concrete = constants.%tuple.elem1]
  387. // CHECK:STDOUT: %.loc7_15: %i32 = acquire_value %tuple.elem1.loc7
  388. // CHECK:STDOUT: %impl.elem0.loc7_15: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664]
  389. // CHECK:STDOUT: %bound_method.loc7_15.1: <bound method> = bound_method %.loc7_15, %impl.elem0.loc7_15
  390. // CHECK:STDOUT: %specific_fn.loc7_15: <specific function> = specific_function %impl.elem0.loc7_15, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  391. // CHECK:STDOUT: %bound_method.loc7_15.2: <bound method> = bound_method %.loc7_15, %specific_fn.loc7_15
  392. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc7: init %i32 = call %bound_method.loc7_15.2(%.loc7_15)
  393. // CHECK:STDOUT: assign file.%d.var, %Int.as.Copy.impl.Op.call.loc7
  394. // CHECK:STDOUT: <elided>
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: --- return_value_access.carbon
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: constants {
  400. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  401. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  402. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  403. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  404. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  405. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  406. // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
  407. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  408. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  409. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  410. // CHECK:STDOUT: %Copy.impl_witness.f17: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_32) [concrete]
  411. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.546: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_32) [concrete]
  412. // CHECK:STDOUT: %Int.as.Copy.impl.Op.664: %Int.as.Copy.impl.Op.type.546 = struct_value () [concrete]
  413. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i32, (%Copy.impl_witness.f17) [concrete]
  414. // CHECK:STDOUT: %Copy.WithSelf.Op.type.081: type = fn_type @Copy.WithSelf.Op, @Copy(%Copy.facet) [concrete]
  415. // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %Copy.WithSelf.Op.type.081, %Copy.facet [concrete]
  416. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.664, @Int.as.Copy.impl.Op(%int_32) [concrete]
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: imports {
  420. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  421. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: fn @Run() -> out %return.param: %i32 {
  425. // CHECK:STDOUT: !entry:
  426. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
  427. // CHECK:STDOUT: %F.call: init %tuple.type.a1c = call %F.ref()
  428. // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
  429. // CHECK:STDOUT: %.loc7_12.1: %tuple.type.a1c = value_of_initializer %F.call
  430. // CHECK:STDOUT: %.loc7_12.2: %tuple.type.a1c = converted %F.call, %.loc7_12.1
  431. // CHECK:STDOUT: %tuple.elem0: %i32 = tuple_access %.loc7_12.2, element0
  432. // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access constants.%Copy.impl_witness.f17, element0 [concrete = constants.%Int.as.Copy.impl.Op.664]
  433. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %tuple.elem0, %impl.elem0
  434. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  435. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %tuple.elem0, %specific_fn
  436. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc7_13.2(%tuple.elem0)
  437. // CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: