member_lookup.carbon 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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/class/generic/member_lookup.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/member_lookup.carbon
  10. // --- member_access.carbon
  11. library "[[@TEST_NAME]]";
  12. base class Base(T:! type) {
  13. var b: T;
  14. }
  15. class Derived(T:! type) {
  16. extend base: Base(T);
  17. var d: T;
  18. }
  19. fn AccessDerived[T:! type](x: Derived(T)) -> T {
  20. return x.d;
  21. }
  22. fn AccessBase[T:! type](x: Derived(T)) -> T {
  23. return x.b;
  24. }
  25. fn AccessConcrete(x: Derived(i32)) -> i32 {
  26. return x.b;
  27. }
  28. // --- fail_no_member.carbon
  29. library "[[@TEST_NAME]]";
  30. base class Base(T:! type) {
  31. var b: T;
  32. }
  33. class Derived(T:! type) {
  34. extend base: Base(T);
  35. var d: T;
  36. }
  37. fn AccessMissingBase[T:! type](x: Base(T)) -> T {
  38. // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Base(T)` [MemberNameNotFoundInScope]
  39. // CHECK:STDERR: return x.nonesuch;
  40. // CHECK:STDERR: ^~~~~~~~~~
  41. // CHECK:STDERR:
  42. return x.nonesuch;
  43. }
  44. fn AccessMissingDerived[T:! type](x: Derived(T)) -> T {
  45. // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Derived(T)` [MemberNameNotFoundInScope]
  46. // CHECK:STDERR: return x.nonesuch;
  47. // CHECK:STDERR: ^~~~~~~~~~
  48. // CHECK:STDERR:
  49. return x.nonesuch;
  50. }
  51. fn AccessMissingConcrete(x: Derived(i32)) -> i32 {
  52. // CHECK:STDERR: fail_no_member.carbon:[[@LINE+4]]:10: error: member name `nonesuch` not found in `Derived(i32)` [MemberNameNotFoundInScope]
  53. // CHECK:STDERR: return x.nonesuch;
  54. // CHECK:STDERR: ^~~~~~~~~~
  55. // CHECK:STDERR:
  56. return x.nonesuch;
  57. }
  58. // CHECK:STDOUT: --- member_access.carbon
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: constants {
  61. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  62. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  63. // CHECK:STDOUT: %Base.type: type = generic_class_type @Base [template]
  64. // CHECK:STDOUT: %Base.generic: %Base.type = struct_value () [template]
  65. // CHECK:STDOUT: %Base.370: type = class_type @Base, @Base(%T) [symbolic]
  66. // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
  67. // CHECK:STDOUT: %Base.elem.9af: type = unbound_element_type %Base.370, %T [symbolic]
  68. // CHECK:STDOUT: %struct_type.b.f69: type = struct_type {.b: %T} [symbolic]
  69. // CHECK:STDOUT: %complete_type.eaf: <witness> = complete_type_witness %struct_type.b.f69 [symbolic]
  70. // CHECK:STDOUT: %Derived.type: type = generic_class_type @Derived [template]
  71. // CHECK:STDOUT: %Derived.generic: %Derived.type = struct_value () [template]
  72. // CHECK:STDOUT: %Derived.85c: type = class_type @Derived, @Derived(%T) [symbolic]
  73. // CHECK:STDOUT: %require_complete.97d: <witness> = require_complete_type %Base.370 [symbolic]
  74. // CHECK:STDOUT: %Derived.elem.8b3: type = unbound_element_type %Derived.85c, %Base.370 [symbolic]
  75. // CHECK:STDOUT: %Derived.elem.6d2: type = unbound_element_type %Derived.85c, %T [symbolic]
  76. // CHECK:STDOUT: %struct_type.base.d.37c: type = struct_type {.base: %Base.370, .d: %T} [symbolic]
  77. // CHECK:STDOUT: %complete_type.8ad: <witness> = complete_type_witness %struct_type.base.d.37c [symbolic]
  78. // CHECK:STDOUT: %AccessDerived.type: type = fn_type @AccessDerived [template]
  79. // CHECK:STDOUT: %AccessDerived: %AccessDerived.type = struct_value () [template]
  80. // CHECK:STDOUT: %require_complete.5f4: <witness> = require_complete_type %Derived.85c [symbolic]
  81. // CHECK:STDOUT: %AccessBase.type: type = fn_type @AccessBase [template]
  82. // CHECK:STDOUT: %AccessBase: %AccessBase.type = struct_value () [template]
  83. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  84. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  85. // CHECK:STDOUT: %Derived.115: type = class_type @Derived, @Derived(%i32) [template]
  86. // CHECK:STDOUT: %AccessConcrete.type: type = fn_type @AccessConcrete [template]
  87. // CHECK:STDOUT: %AccessConcrete: %AccessConcrete.type = struct_value () [template]
  88. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [template]
  89. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [template]
  90. // CHECK:STDOUT: %Base.10a: type = class_type @Base, @Base(%i32) [template]
  91. // CHECK:STDOUT: %Base.elem.a98: type = unbound_element_type %Base.10a, %i32 [template]
  92. // CHECK:STDOUT: %struct_type.b.0a3: type = struct_type {.b: %i32} [template]
  93. // CHECK:STDOUT: %complete_type.ba8: <witness> = complete_type_witness %struct_type.b.0a3 [template]
  94. // CHECK:STDOUT: %Derived.elem.0c4: type = unbound_element_type %Derived.115, %Base.10a [template]
  95. // CHECK:STDOUT: %Derived.elem.b58: type = unbound_element_type %Derived.115, %i32 [template]
  96. // CHECK:STDOUT: %struct_type.base.d.ffa: type = struct_type {.base: %Base.10a, .d: %i32} [template]
  97. // CHECK:STDOUT: %complete_type.544: <witness> = complete_type_witness %struct_type.base.d.ffa [template]
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: imports {
  101. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  102. // CHECK:STDOUT: .Int = %Core.Int
  103. // CHECK:STDOUT: import Core//prelude
  104. // CHECK:STDOUT: import Core//prelude/...
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT:
  108. // CHECK:STDOUT: file {
  109. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  110. // CHECK:STDOUT: .Core = imports.%Core
  111. // CHECK:STDOUT: .Base = %Base.decl
  112. // CHECK:STDOUT: .Derived = %Derived.decl
  113. // CHECK:STDOUT: .AccessDerived = %AccessDerived.decl
  114. // CHECK:STDOUT: .AccessBase = %AccessBase.decl
  115. // CHECK:STDOUT: .AccessConcrete = %AccessConcrete.decl
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: %Core.import = import Core
  118. // CHECK:STDOUT: %Base.decl: %Base.type = class_decl @Base [template = constants.%Base.generic] {
  119. // CHECK:STDOUT: %T.patt.loc4_17.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  120. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_17.1, runtime_param<none> [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  121. // CHECK:STDOUT: } {
  122. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  123. // CHECK:STDOUT: %T.loc4_17.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_17.2 (constants.%T)]
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT: %Derived.decl: %Derived.type = class_decl @Derived [template = constants.%Derived.generic] {
  126. // CHECK:STDOUT: %T.patt.loc8_15.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  127. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_15.1, runtime_param<none> [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  128. // CHECK:STDOUT: } {
  129. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  130. // CHECK:STDOUT: %T.loc8_15.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_15.2 (constants.%T)]
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT: %AccessDerived.decl: %AccessDerived.type = fn_decl @AccessDerived [template = constants.%AccessDerived] {
  133. // CHECK:STDOUT: %T.patt.loc13_18.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_18.2 (constants.%T.patt)]
  134. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc13_18.1, runtime_param<none> [symbolic = %T.patt.loc13_18.2 (constants.%T.patt)]
  135. // CHECK:STDOUT: %x.patt: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) = binding_pattern x
  136. // CHECK:STDOUT: %x.param_patt: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) = value_param_pattern %x.patt, runtime_param0
  137. // CHECK:STDOUT: %return.patt: @AccessDerived.%T.loc13_18.2 (%T) = return_slot_pattern
  138. // CHECK:STDOUT: %return.param_patt: @AccessDerived.%T.loc13_18.2 (%T) = out_param_pattern %return.patt, runtime_param1
  139. // CHECK:STDOUT: } {
  140. // CHECK:STDOUT: %T.ref.loc13_46: type = name_ref T, %T.loc13_18.1 [symbolic = %T.loc13_18.2 (constants.%T)]
  141. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  142. // CHECK:STDOUT: %T.loc13_18.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc13_18.2 (constants.%T)]
  143. // CHECK:STDOUT: %x.param: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) = value_param runtime_param0
  144. // CHECK:STDOUT: %.loc13: type = splice_block %Derived.loc13_40.1 [symbolic = %Derived.loc13_40.2 (constants.%Derived.85c)] {
  145. // CHECK:STDOUT: %Derived.ref: %Derived.type = name_ref Derived, file.%Derived.decl [template = constants.%Derived.generic]
  146. // CHECK:STDOUT: %T.ref.loc13_39: type = name_ref T, %T.loc13_18.1 [symbolic = %T.loc13_18.2 (constants.%T)]
  147. // CHECK:STDOUT: %Derived.loc13_40.1: type = class_type @Derived, @Derived(constants.%T) [symbolic = %Derived.loc13_40.2 (constants.%Derived.85c)]
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %x: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) = bind_name x, %x.param
  150. // CHECK:STDOUT: %return.param: ref @AccessDerived.%T.loc13_18.2 (%T) = out_param runtime_param1
  151. // CHECK:STDOUT: %return: ref @AccessDerived.%T.loc13_18.2 (%T) = return_slot %return.param
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT: %AccessBase.decl: %AccessBase.type = fn_decl @AccessBase [template = constants.%AccessBase] {
  154. // CHECK:STDOUT: %T.patt.loc17_15.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)]
  155. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc17_15.1, runtime_param<none> [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)]
  156. // CHECK:STDOUT: %x.patt: @AccessBase.%Derived.loc17_37.2 (%Derived.85c) = binding_pattern x
  157. // CHECK:STDOUT: %x.param_patt: @AccessBase.%Derived.loc17_37.2 (%Derived.85c) = value_param_pattern %x.patt, runtime_param0
  158. // CHECK:STDOUT: %return.patt: @AccessBase.%T.loc17_15.2 (%T) = return_slot_pattern
  159. // CHECK:STDOUT: %return.param_patt: @AccessBase.%T.loc17_15.2 (%T) = out_param_pattern %return.patt, runtime_param1
  160. // CHECK:STDOUT: } {
  161. // CHECK:STDOUT: %T.ref.loc17_43: type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)]
  162. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  163. // CHECK:STDOUT: %T.loc17_15.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc17_15.2 (constants.%T)]
  164. // CHECK:STDOUT: %x.param: @AccessBase.%Derived.loc17_37.2 (%Derived.85c) = value_param runtime_param0
  165. // CHECK:STDOUT: %.loc17: type = splice_block %Derived.loc17_37.1 [symbolic = %Derived.loc17_37.2 (constants.%Derived.85c)] {
  166. // CHECK:STDOUT: %Derived.ref: %Derived.type = name_ref Derived, file.%Derived.decl [template = constants.%Derived.generic]
  167. // CHECK:STDOUT: %T.ref.loc17_36: type = name_ref T, %T.loc17_15.1 [symbolic = %T.loc17_15.2 (constants.%T)]
  168. // CHECK:STDOUT: %Derived.loc17_37.1: type = class_type @Derived, @Derived(constants.%T) [symbolic = %Derived.loc17_37.2 (constants.%Derived.85c)]
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: %x: @AccessBase.%Derived.loc17_37.2 (%Derived.85c) = bind_name x, %x.param
  171. // CHECK:STDOUT: %return.param: ref @AccessBase.%T.loc17_15.2 (%T) = out_param runtime_param1
  172. // CHECK:STDOUT: %return: ref @AccessBase.%T.loc17_15.2 (%T) = return_slot %return.param
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %AccessConcrete.decl: %AccessConcrete.type = fn_decl @AccessConcrete [template = constants.%AccessConcrete] {
  175. // CHECK:STDOUT: %x.patt: %Derived.115 = binding_pattern x
  176. // CHECK:STDOUT: %x.param_patt: %Derived.115 = value_param_pattern %x.patt, runtime_param0
  177. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  178. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  179. // CHECK:STDOUT: } {
  180. // CHECK:STDOUT: %int_32.loc21_39: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  181. // CHECK:STDOUT: %i32.loc21_39: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  182. // CHECK:STDOUT: %x.param: %Derived.115 = value_param runtime_param0
  183. // CHECK:STDOUT: %.loc21: type = splice_block %Derived [template = constants.%Derived.115] {
  184. // CHECK:STDOUT: %Derived.ref: %Derived.type = name_ref Derived, file.%Derived.decl [template = constants.%Derived.generic]
  185. // CHECK:STDOUT: %int_32.loc21_30: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  186. // CHECK:STDOUT: %i32.loc21_30: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  187. // CHECK:STDOUT: %Derived: type = class_type @Derived, @Derived(constants.%i32) [template = constants.%Derived.115]
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %x: %Derived.115 = bind_name x, %x.param
  190. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  191. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: generic class @Base(%T.loc4_17.1: type) {
  196. // CHECK:STDOUT: %T.loc4_17.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)]
  197. // CHECK:STDOUT: %T.patt.loc4_17.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: !definition:
  200. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @Base.%T.loc4_17.2 (%T) [symbolic = %require_complete (constants.%require_complete.4ae)]
  201. // CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.loc4_17.2) [symbolic = %Base (constants.%Base.370)]
  202. // CHECK:STDOUT: %Base.elem: type = unbound_element_type @Base.%Base (%Base.370), @Base.%T.loc4_17.2 (%T) [symbolic = %Base.elem (constants.%Base.elem.9af)]
  203. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: @Base.%T.loc4_17.2 (%T)} [symbolic = %struct_type.b (constants.%struct_type.b.f69)]
  204. // CHECK:STDOUT: %complete_type.loc6_1.2: <witness> = complete_type_witness @Base.%struct_type.b (%struct_type.b.f69) [symbolic = %complete_type.loc6_1.2 (constants.%complete_type.eaf)]
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: class {
  207. // CHECK:STDOUT: %.loc5_8: @Base.%Base.elem (%Base.elem.9af) = field_decl b, element0 [template]
  208. // CHECK:STDOUT: name_binding_decl {
  209. // CHECK:STDOUT: %.loc5_3: @Base.%Base.elem (%Base.elem.9af) = var_pattern %.loc5_8
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %.var: ref @Base.%Base.elem (%Base.elem.9af) = var <none>
  212. // CHECK:STDOUT: %complete_type.loc6_1.1: <witness> = complete_type_witness %struct_type.b.f69 [symbolic = %complete_type.loc6_1.2 (constants.%complete_type.eaf)]
  213. // CHECK:STDOUT: complete_type_witness = %complete_type.loc6_1.1
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: !members:
  216. // CHECK:STDOUT: .Self = constants.%Base.370
  217. // CHECK:STDOUT: .b = %.loc5_8
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: generic class @Derived(%T.loc8_15.1: type) {
  222. // CHECK:STDOUT: %T.loc8_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)]
  223. // CHECK:STDOUT: %T.patt.loc8_15.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: !definition:
  226. // CHECK:STDOUT: %Base.loc9_22.2: type = class_type @Base, @Base(%T.loc8_15.2) [symbolic = %Base.loc9_22.2 (constants.%Base.370)]
  227. // CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type @Derived.%Base.loc9_22.2 (%Base.370) [symbolic = %require_complete.loc9 (constants.%require_complete.97d)]
  228. // CHECK:STDOUT: %Derived: type = class_type @Derived, @Derived(%T.loc8_15.2) [symbolic = %Derived (constants.%Derived.85c)]
  229. // CHECK:STDOUT: %Derived.elem.loc9: type = unbound_element_type @Derived.%Derived (%Derived.85c), @Derived.%Base.loc9_22.2 (%Base.370) [symbolic = %Derived.elem.loc9 (constants.%Derived.elem.8b3)]
  230. // CHECK:STDOUT: %require_complete.loc10: <witness> = require_complete_type @Derived.%T.loc8_15.2 (%T) [symbolic = %require_complete.loc10 (constants.%require_complete.4ae)]
  231. // CHECK:STDOUT: %Derived.elem.loc10: type = unbound_element_type @Derived.%Derived (%Derived.85c), @Derived.%T.loc8_15.2 (%T) [symbolic = %Derived.elem.loc10 (constants.%Derived.elem.6d2)]
  232. // CHECK:STDOUT: %struct_type.base.d: type = struct_type {.base: @Derived.%Base.loc9_22.2 (%Base.370), .d: @Derived.%T.loc8_15.2 (%T)} [symbolic = %struct_type.base.d (constants.%struct_type.base.d.37c)]
  233. // CHECK:STDOUT: %complete_type.loc11_1.2: <witness> = complete_type_witness @Derived.%struct_type.base.d (%struct_type.base.d.37c) [symbolic = %complete_type.loc11_1.2 (constants.%complete_type.8ad)]
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: class {
  236. // CHECK:STDOUT: %Base.ref: %Base.type = name_ref Base, file.%Base.decl [template = constants.%Base.generic]
  237. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)]
  238. // CHECK:STDOUT: %Base.loc9_22.1: type = class_type @Base, @Base(constants.%T) [symbolic = %Base.loc9_22.2 (constants.%Base.370)]
  239. // CHECK:STDOUT: %.loc9: @Derived.%Derived.elem.loc9 (%Derived.elem.8b3) = base_decl %Base.loc9_22.1, element0 [template]
  240. // CHECK:STDOUT: %.loc10_8: @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = field_decl d, element1 [template]
  241. // CHECK:STDOUT: name_binding_decl {
  242. // CHECK:STDOUT: %.loc10_3: @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = var_pattern %.loc10_8
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT: %.var: ref @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = var <none>
  245. // CHECK:STDOUT: %complete_type.loc11_1.1: <witness> = complete_type_witness %struct_type.base.d.37c [symbolic = %complete_type.loc11_1.2 (constants.%complete_type.8ad)]
  246. // CHECK:STDOUT: complete_type_witness = %complete_type.loc11_1.1
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: !members:
  249. // CHECK:STDOUT: .Self = constants.%Derived.85c
  250. // CHECK:STDOUT: .base = %.loc9
  251. // CHECK:STDOUT: .d = %.loc10_8
  252. // CHECK:STDOUT: extend %Base.loc9_22.1
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: generic fn @AccessDerived(%T.loc13_18.1: type) {
  257. // CHECK:STDOUT: %T.loc13_18.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc13_18.2 (constants.%T)]
  258. // CHECK:STDOUT: %T.patt.loc13_18.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_18.2 (constants.%T.patt)]
  259. // CHECK:STDOUT: %Derived.loc13_40.2: type = class_type @Derived, @Derived(%T.loc13_18.2) [symbolic = %Derived.loc13_40.2 (constants.%Derived.85c)]
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: !definition:
  262. // CHECK:STDOUT: %require_complete.loc13: <witness> = require_complete_type @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) [symbolic = %require_complete.loc13 (constants.%require_complete.5f4)]
  263. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type @AccessDerived.%Derived.loc13_40.2 (%Derived.85c), @AccessDerived.%T.loc13_18.2 (%T) [symbolic = %Derived.elem (constants.%Derived.elem.6d2)]
  264. // CHECK:STDOUT: %require_complete.loc14: <witness> = require_complete_type @AccessDerived.%T.loc13_18.2 (%T) [symbolic = %require_complete.loc14 (constants.%require_complete.4ae)]
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c)) -> @AccessDerived.%T.loc13_18.2 (%T) {
  267. // CHECK:STDOUT: !entry:
  268. // CHECK:STDOUT: %x.ref: @AccessDerived.%Derived.loc13_40.2 (%Derived.85c) = name_ref x, %x
  269. // CHECK:STDOUT: %d.ref: @AccessDerived.%Derived.elem (%Derived.elem.6d2) = name_ref d, @Derived.%.loc10_8 [template = @Derived.%.loc10_8]
  270. // CHECK:STDOUT: %.loc14_11.1: ref @AccessDerived.%T.loc13_18.2 (%T) = class_element_access %x.ref, element1
  271. // CHECK:STDOUT: %.loc14_11.2: @AccessDerived.%T.loc13_18.2 (%T) = bind_value %.loc14_11.1
  272. // CHECK:STDOUT: return %.loc14_11.2
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: generic fn @AccessBase(%T.loc17_15.1: type) {
  277. // CHECK:STDOUT: %T.loc17_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc17_15.2 (constants.%T)]
  278. // CHECK:STDOUT: %T.patt.loc17_15.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc17_15.2 (constants.%T.patt)]
  279. // CHECK:STDOUT: %Derived.loc17_37.2: type = class_type @Derived, @Derived(%T.loc17_15.2) [symbolic = %Derived.loc17_37.2 (constants.%Derived.85c)]
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: !definition:
  282. // CHECK:STDOUT: %require_complete.loc17: <witness> = require_complete_type @AccessBase.%Derived.loc17_37.2 (%Derived.85c) [symbolic = %require_complete.loc17 (constants.%require_complete.5f4)]
  283. // CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.loc17_15.2) [symbolic = %Base (constants.%Base.370)]
  284. // CHECK:STDOUT: %require_complete.loc18_11: <witness> = require_complete_type @AccessBase.%Base (%Base.370) [symbolic = %require_complete.loc18_11 (constants.%require_complete.97d)]
  285. // CHECK:STDOUT: %Base.elem: type = unbound_element_type @AccessBase.%Base (%Base.370), @AccessBase.%T.loc17_15.2 (%T) [symbolic = %Base.elem (constants.%Base.elem.9af)]
  286. // CHECK:STDOUT: %require_complete.loc18_13: <witness> = require_complete_type @AccessBase.%T.loc17_15.2 (%T) [symbolic = %require_complete.loc18_13 (constants.%require_complete.4ae)]
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @AccessBase.%Derived.loc17_37.2 (%Derived.85c)) -> @AccessBase.%T.loc17_15.2 (%T) {
  289. // CHECK:STDOUT: !entry:
  290. // CHECK:STDOUT: %x.ref: @AccessBase.%Derived.loc17_37.2 (%Derived.85c) = name_ref x, %x
  291. // CHECK:STDOUT: %b.ref: @AccessBase.%Base.elem (%Base.elem.9af) = name_ref b, @Base.%.loc5_8 [template = @Base.%.loc5_8]
  292. // CHECK:STDOUT: %.loc18_11.1: ref @AccessBase.%Base (%Base.370) = class_element_access %x.ref, element0
  293. // CHECK:STDOUT: %.loc18_11.2: ref @AccessBase.%Base (%Base.370) = converted %x.ref, %.loc18_11.1
  294. // CHECK:STDOUT: %.loc18_11.3: ref @AccessBase.%T.loc17_15.2 (%T) = class_element_access %.loc18_11.2, element0
  295. // CHECK:STDOUT: %.loc18_11.4: @AccessBase.%T.loc17_15.2 (%T) = bind_value %.loc18_11.3
  296. // CHECK:STDOUT: return %.loc18_11.4
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: fn @AccessConcrete(%x.param_patt: %Derived.115) -> %i32 {
  301. // CHECK:STDOUT: !entry:
  302. // CHECK:STDOUT: %x.ref: %Derived.115 = name_ref x, %x
  303. // CHECK:STDOUT: %b.ref: %Base.elem.a98 = name_ref b, @Base.%.loc5_8 [template = @Base.%.loc5_8]
  304. // CHECK:STDOUT: %.loc22_11.1: ref %Base.10a = class_element_access %x.ref, element0
  305. // CHECK:STDOUT: %.loc22_11.2: ref %Base.10a = converted %x.ref, %.loc22_11.1
  306. // CHECK:STDOUT: %.loc22_11.3: ref %i32 = class_element_access %.loc22_11.2, element0
  307. // CHECK:STDOUT: %.loc22_11.4: %i32 = bind_value %.loc22_11.3
  308. // CHECK:STDOUT: return %.loc22_11.4
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: specific @Base(constants.%T) {
  312. // CHECK:STDOUT: %T.loc4_17.2 => constants.%T
  313. // CHECK:STDOUT: %T.patt.loc4_17.2 => constants.%T
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: !definition:
  316. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  317. // CHECK:STDOUT: %Base => constants.%Base.370
  318. // CHECK:STDOUT: %Base.elem => constants.%Base.elem.9af
  319. // CHECK:STDOUT: %struct_type.b => constants.%struct_type.b.f69
  320. // CHECK:STDOUT: %complete_type.loc6_1.2 => constants.%complete_type.eaf
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: specific @Base(%T.loc4_17.2) {}
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: specific @Derived(constants.%T) {
  326. // CHECK:STDOUT: %T.loc8_15.2 => constants.%T
  327. // CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: !definition:
  330. // CHECK:STDOUT: %Base.loc9_22.2 => constants.%Base.370
  331. // CHECK:STDOUT: %require_complete.loc9 => constants.%require_complete.97d
  332. // CHECK:STDOUT: %Derived => constants.%Derived.85c
  333. // CHECK:STDOUT: %Derived.elem.loc9 => constants.%Derived.elem.8b3
  334. // CHECK:STDOUT: %require_complete.loc10 => constants.%require_complete.4ae
  335. // CHECK:STDOUT: %Derived.elem.loc10 => constants.%Derived.elem.6d2
  336. // CHECK:STDOUT: %struct_type.base.d => constants.%struct_type.base.d.37c
  337. // CHECK:STDOUT: %complete_type.loc11_1.2 => constants.%complete_type.8ad
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: specific @Base(@Derived.%T.loc8_15.2) {}
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: specific @Derived(%T.loc8_15.2) {}
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: specific @AccessDerived(constants.%T) {
  345. // CHECK:STDOUT: %T.loc13_18.2 => constants.%T
  346. // CHECK:STDOUT: %T.patt.loc13_18.2 => constants.%T
  347. // CHECK:STDOUT: %Derived.loc13_40.2 => constants.%Derived.85c
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: specific @Derived(@AccessDerived.%T.loc13_18.2) {}
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: specific @AccessBase(constants.%T) {
  353. // CHECK:STDOUT: %T.loc17_15.2 => constants.%T
  354. // CHECK:STDOUT: %T.patt.loc17_15.2 => constants.%T
  355. // CHECK:STDOUT: %Derived.loc17_37.2 => constants.%Derived.85c
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Derived(@AccessBase.%T.loc17_15.2) {}
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: specific @Base(@AccessBase.%T.loc17_15.2) {}
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: specific @Derived(constants.%i32) {
  363. // CHECK:STDOUT: %T.loc8_15.2 => constants.%i32
  364. // CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%i32
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: !definition:
  367. // CHECK:STDOUT: %Base.loc9_22.2 => constants.%Base.10a
  368. // CHECK:STDOUT: %require_complete.loc9 => constants.%complete_type.ba8
  369. // CHECK:STDOUT: %Derived => constants.%Derived.115
  370. // CHECK:STDOUT: %Derived.elem.loc9 => constants.%Derived.elem.0c4
  371. // CHECK:STDOUT: %require_complete.loc10 => constants.%complete_type.f8a
  372. // CHECK:STDOUT: %Derived.elem.loc10 => constants.%Derived.elem.b58
  373. // CHECK:STDOUT: %struct_type.base.d => constants.%struct_type.base.d.ffa
  374. // CHECK:STDOUT: %complete_type.loc11_1.2 => constants.%complete_type.544
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: specific @Base(constants.%i32) {
  378. // CHECK:STDOUT: %T.loc4_17.2 => constants.%i32
  379. // CHECK:STDOUT: %T.patt.loc4_17.2 => constants.%i32
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: !definition:
  382. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  383. // CHECK:STDOUT: %Base => constants.%Base.10a
  384. // CHECK:STDOUT: %Base.elem => constants.%Base.elem.a98
  385. // CHECK:STDOUT: %struct_type.b => constants.%struct_type.b.0a3
  386. // CHECK:STDOUT: %complete_type.loc6_1.2 => constants.%complete_type.ba8
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: --- fail_no_member.carbon
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: constants {
  392. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  393. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  394. // CHECK:STDOUT: %Base.type: type = generic_class_type @Base [template]
  395. // CHECK:STDOUT: %Base.generic: %Base.type = struct_value () [template]
  396. // CHECK:STDOUT: %Base.370: type = class_type @Base, @Base(%T) [symbolic]
  397. // CHECK:STDOUT: %require_complete.4ae: <witness> = require_complete_type %T [symbolic]
  398. // CHECK:STDOUT: %Base.elem.9af: type = unbound_element_type %Base.370, %T [symbolic]
  399. // CHECK:STDOUT: %struct_type.b.f69: type = struct_type {.b: %T} [symbolic]
  400. // CHECK:STDOUT: %complete_type.eaf: <witness> = complete_type_witness %struct_type.b.f69 [symbolic]
  401. // CHECK:STDOUT: %Derived.type: type = generic_class_type @Derived [template]
  402. // CHECK:STDOUT: %Derived.generic: %Derived.type = struct_value () [template]
  403. // CHECK:STDOUT: %Derived.85c: type = class_type @Derived, @Derived(%T) [symbolic]
  404. // CHECK:STDOUT: %require_complete.97d: <witness> = require_complete_type %Base.370 [symbolic]
  405. // CHECK:STDOUT: %Derived.elem.8b3: type = unbound_element_type %Derived.85c, %Base.370 [symbolic]
  406. // CHECK:STDOUT: %Derived.elem.6d2: type = unbound_element_type %Derived.85c, %T [symbolic]
  407. // CHECK:STDOUT: %struct_type.base.d.37c: type = struct_type {.base: %Base.370, .d: %T} [symbolic]
  408. // CHECK:STDOUT: %complete_type.8ad: <witness> = complete_type_witness %struct_type.base.d.37c [symbolic]
  409. // CHECK:STDOUT: %AccessMissingBase.type: type = fn_type @AccessMissingBase [template]
  410. // CHECK:STDOUT: %AccessMissingBase: %AccessMissingBase.type = struct_value () [template]
  411. // CHECK:STDOUT: %AccessMissingDerived.type: type = fn_type @AccessMissingDerived [template]
  412. // CHECK:STDOUT: %AccessMissingDerived: %AccessMissingDerived.type = struct_value () [template]
  413. // CHECK:STDOUT: %require_complete.5f4: <witness> = require_complete_type %Derived.85c [symbolic]
  414. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  415. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  416. // CHECK:STDOUT: %Derived.115: type = class_type @Derived, @Derived(%i32) [template]
  417. // CHECK:STDOUT: %AccessMissingConcrete.type: type = fn_type @AccessMissingConcrete [template]
  418. // CHECK:STDOUT: %AccessMissingConcrete: %AccessMissingConcrete.type = struct_value () [template]
  419. // CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [template]
  420. // CHECK:STDOUT: %complete_type.f8a: <witness> = complete_type_witness %i32.builtin [template]
  421. // CHECK:STDOUT: %Base.10a: type = class_type @Base, @Base(%i32) [template]
  422. // CHECK:STDOUT: %Base.elem.a98: type = unbound_element_type %Base.10a, %i32 [template]
  423. // CHECK:STDOUT: %struct_type.b.0a3: type = struct_type {.b: %i32} [template]
  424. // CHECK:STDOUT: %complete_type.ba8: <witness> = complete_type_witness %struct_type.b.0a3 [template]
  425. // CHECK:STDOUT: %Derived.elem.0c4: type = unbound_element_type %Derived.115, %Base.10a [template]
  426. // CHECK:STDOUT: %Derived.elem.b58: type = unbound_element_type %Derived.115, %i32 [template]
  427. // CHECK:STDOUT: %struct_type.base.d.ffa: type = struct_type {.base: %Base.10a, .d: %i32} [template]
  428. // CHECK:STDOUT: %complete_type.544: <witness> = complete_type_witness %struct_type.base.d.ffa [template]
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: imports {
  432. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  433. // CHECK:STDOUT: .Int = %Core.Int
  434. // CHECK:STDOUT: import Core//prelude
  435. // CHECK:STDOUT: import Core//prelude/...
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: file {
  440. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  441. // CHECK:STDOUT: .Core = imports.%Core
  442. // CHECK:STDOUT: .Base = %Base.decl
  443. // CHECK:STDOUT: .Derived = %Derived.decl
  444. // CHECK:STDOUT: .AccessMissingBase = %AccessMissingBase.decl
  445. // CHECK:STDOUT: .AccessMissingDerived = %AccessMissingDerived.decl
  446. // CHECK:STDOUT: .AccessMissingConcrete = %AccessMissingConcrete.decl
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT: %Core.import = import Core
  449. // CHECK:STDOUT: %Base.decl: %Base.type = class_decl @Base [template = constants.%Base.generic] {
  450. // CHECK:STDOUT: %T.patt.loc4_17.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  451. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_17.1, runtime_param<none> [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  452. // CHECK:STDOUT: } {
  453. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  454. // CHECK:STDOUT: %T.loc4_17.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_17.2 (constants.%T)]
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT: %Derived.decl: %Derived.type = class_decl @Derived [template = constants.%Derived.generic] {
  457. // CHECK:STDOUT: %T.patt.loc8_15.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  458. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_15.1, runtime_param<none> [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  459. // CHECK:STDOUT: } {
  460. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  461. // CHECK:STDOUT: %T.loc8_15.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_15.2 (constants.%T)]
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT: %AccessMissingBase.decl: %AccessMissingBase.type = fn_decl @AccessMissingBase [template = constants.%AccessMissingBase] {
  464. // CHECK:STDOUT: %T.patt.loc13_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_22.2 (constants.%T.patt)]
  465. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc13_22.1, runtime_param<none> [symbolic = %T.patt.loc13_22.2 (constants.%T.patt)]
  466. // CHECK:STDOUT: %x.patt: @AccessMissingBase.%Base.loc13_41.2 (%Base.370) = binding_pattern x
  467. // CHECK:STDOUT: %x.param_patt: @AccessMissingBase.%Base.loc13_41.2 (%Base.370) = value_param_pattern %x.patt, runtime_param0
  468. // CHECK:STDOUT: %return.patt: @AccessMissingBase.%T.loc13_22.2 (%T) = return_slot_pattern
  469. // CHECK:STDOUT: %return.param_patt: @AccessMissingBase.%T.loc13_22.2 (%T) = out_param_pattern %return.patt, runtime_param1
  470. // CHECK:STDOUT: } {
  471. // CHECK:STDOUT: %T.ref.loc13_47: type = name_ref T, %T.loc13_22.1 [symbolic = %T.loc13_22.2 (constants.%T)]
  472. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  473. // CHECK:STDOUT: %T.loc13_22.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc13_22.2 (constants.%T)]
  474. // CHECK:STDOUT: %x.param: @AccessMissingBase.%Base.loc13_41.2 (%Base.370) = value_param runtime_param0
  475. // CHECK:STDOUT: %.loc13: type = splice_block %Base.loc13_41.1 [symbolic = %Base.loc13_41.2 (constants.%Base.370)] {
  476. // CHECK:STDOUT: %Base.ref: %Base.type = name_ref Base, file.%Base.decl [template = constants.%Base.generic]
  477. // CHECK:STDOUT: %T.ref.loc13_40: type = name_ref T, %T.loc13_22.1 [symbolic = %T.loc13_22.2 (constants.%T)]
  478. // CHECK:STDOUT: %Base.loc13_41.1: type = class_type @Base, @Base(constants.%T) [symbolic = %Base.loc13_41.2 (constants.%Base.370)]
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: %x: @AccessMissingBase.%Base.loc13_41.2 (%Base.370) = bind_name x, %x.param
  481. // CHECK:STDOUT: %return.param: ref @AccessMissingBase.%T.loc13_22.2 (%T) = out_param runtime_param1
  482. // CHECK:STDOUT: %return: ref @AccessMissingBase.%T.loc13_22.2 (%T) = return_slot %return.param
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT: %AccessMissingDerived.decl: %AccessMissingDerived.type = fn_decl @AccessMissingDerived [template = constants.%AccessMissingDerived] {
  485. // CHECK:STDOUT: %T.patt.loc21_25.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_25.2 (constants.%T.patt)]
  486. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc21_25.1, runtime_param<none> [symbolic = %T.patt.loc21_25.2 (constants.%T.patt)]
  487. // CHECK:STDOUT: %x.patt: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) = binding_pattern x
  488. // CHECK:STDOUT: %x.param_patt: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) = value_param_pattern %x.patt, runtime_param0
  489. // CHECK:STDOUT: %return.patt: @AccessMissingDerived.%T.loc21_25.2 (%T) = return_slot_pattern
  490. // CHECK:STDOUT: %return.param_patt: @AccessMissingDerived.%T.loc21_25.2 (%T) = out_param_pattern %return.patt, runtime_param1
  491. // CHECK:STDOUT: } {
  492. // CHECK:STDOUT: %T.ref.loc21_53: type = name_ref T, %T.loc21_25.1 [symbolic = %T.loc21_25.2 (constants.%T)]
  493. // CHECK:STDOUT: %T.param: type = value_param runtime_param<none>
  494. // CHECK:STDOUT: %T.loc21_25.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc21_25.2 (constants.%T)]
  495. // CHECK:STDOUT: %x.param: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) = value_param runtime_param0
  496. // CHECK:STDOUT: %.loc21: type = splice_block %Derived.loc21_47.1 [symbolic = %Derived.loc21_47.2 (constants.%Derived.85c)] {
  497. // CHECK:STDOUT: %Derived.ref: %Derived.type = name_ref Derived, file.%Derived.decl [template = constants.%Derived.generic]
  498. // CHECK:STDOUT: %T.ref.loc21_46: type = name_ref T, %T.loc21_25.1 [symbolic = %T.loc21_25.2 (constants.%T)]
  499. // CHECK:STDOUT: %Derived.loc21_47.1: type = class_type @Derived, @Derived(constants.%T) [symbolic = %Derived.loc21_47.2 (constants.%Derived.85c)]
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT: %x: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) = bind_name x, %x.param
  502. // CHECK:STDOUT: %return.param: ref @AccessMissingDerived.%T.loc21_25.2 (%T) = out_param runtime_param1
  503. // CHECK:STDOUT: %return: ref @AccessMissingDerived.%T.loc21_25.2 (%T) = return_slot %return.param
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT: %AccessMissingConcrete.decl: %AccessMissingConcrete.type = fn_decl @AccessMissingConcrete [template = constants.%AccessMissingConcrete] {
  506. // CHECK:STDOUT: %x.patt: %Derived.115 = binding_pattern x
  507. // CHECK:STDOUT: %x.param_patt: %Derived.115 = value_param_pattern %x.patt, runtime_param0
  508. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  509. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  510. // CHECK:STDOUT: } {
  511. // CHECK:STDOUT: %int_32.loc29_46: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  512. // CHECK:STDOUT: %i32.loc29_46: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  513. // CHECK:STDOUT: %x.param: %Derived.115 = value_param runtime_param0
  514. // CHECK:STDOUT: %.loc29: type = splice_block %Derived [template = constants.%Derived.115] {
  515. // CHECK:STDOUT: %Derived.ref: %Derived.type = name_ref Derived, file.%Derived.decl [template = constants.%Derived.generic]
  516. // CHECK:STDOUT: %int_32.loc29_37: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  517. // CHECK:STDOUT: %i32.loc29_37: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  518. // CHECK:STDOUT: %Derived: type = class_type @Derived, @Derived(constants.%i32) [template = constants.%Derived.115]
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: %x: %Derived.115 = bind_name x, %x.param
  521. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  522. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: generic class @Base(%T.loc4_17.1: type) {
  527. // CHECK:STDOUT: %T.loc4_17.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_17.2 (constants.%T)]
  528. // CHECK:STDOUT: %T.patt.loc4_17.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_17.2 (constants.%T.patt)]
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: !definition:
  531. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @Base.%T.loc4_17.2 (%T) [symbolic = %require_complete (constants.%require_complete.4ae)]
  532. // CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.loc4_17.2) [symbolic = %Base (constants.%Base.370)]
  533. // CHECK:STDOUT: %Base.elem: type = unbound_element_type @Base.%Base (%Base.370), @Base.%T.loc4_17.2 (%T) [symbolic = %Base.elem (constants.%Base.elem.9af)]
  534. // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: @Base.%T.loc4_17.2 (%T)} [symbolic = %struct_type.b (constants.%struct_type.b.f69)]
  535. // CHECK:STDOUT: %complete_type.loc6_1.2: <witness> = complete_type_witness @Base.%struct_type.b (%struct_type.b.f69) [symbolic = %complete_type.loc6_1.2 (constants.%complete_type.eaf)]
  536. // CHECK:STDOUT:
  537. // CHECK:STDOUT: class {
  538. // CHECK:STDOUT: %.loc5_8: @Base.%Base.elem (%Base.elem.9af) = field_decl b, element0 [template]
  539. // CHECK:STDOUT: name_binding_decl {
  540. // CHECK:STDOUT: %.loc5_3: @Base.%Base.elem (%Base.elem.9af) = var_pattern %.loc5_8
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT: %.var: ref @Base.%Base.elem (%Base.elem.9af) = var <none>
  543. // CHECK:STDOUT: %complete_type.loc6_1.1: <witness> = complete_type_witness %struct_type.b.f69 [symbolic = %complete_type.loc6_1.2 (constants.%complete_type.eaf)]
  544. // CHECK:STDOUT: complete_type_witness = %complete_type.loc6_1.1
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: !members:
  547. // CHECK:STDOUT: .Self = constants.%Base.370
  548. // CHECK:STDOUT: .b = %.loc5_8
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: generic class @Derived(%T.loc8_15.1: type) {
  553. // CHECK:STDOUT: %T.loc8_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_15.2 (constants.%T)]
  554. // CHECK:STDOUT: %T.patt.loc8_15.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_15.2 (constants.%T.patt)]
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: !definition:
  557. // CHECK:STDOUT: %Base.loc9_22.2: type = class_type @Base, @Base(%T.loc8_15.2) [symbolic = %Base.loc9_22.2 (constants.%Base.370)]
  558. // CHECK:STDOUT: %require_complete.loc9: <witness> = require_complete_type @Derived.%Base.loc9_22.2 (%Base.370) [symbolic = %require_complete.loc9 (constants.%require_complete.97d)]
  559. // CHECK:STDOUT: %Derived: type = class_type @Derived, @Derived(%T.loc8_15.2) [symbolic = %Derived (constants.%Derived.85c)]
  560. // CHECK:STDOUT: %Derived.elem.loc9: type = unbound_element_type @Derived.%Derived (%Derived.85c), @Derived.%Base.loc9_22.2 (%Base.370) [symbolic = %Derived.elem.loc9 (constants.%Derived.elem.8b3)]
  561. // CHECK:STDOUT: %require_complete.loc10: <witness> = require_complete_type @Derived.%T.loc8_15.2 (%T) [symbolic = %require_complete.loc10 (constants.%require_complete.4ae)]
  562. // CHECK:STDOUT: %Derived.elem.loc10: type = unbound_element_type @Derived.%Derived (%Derived.85c), @Derived.%T.loc8_15.2 (%T) [symbolic = %Derived.elem.loc10 (constants.%Derived.elem.6d2)]
  563. // CHECK:STDOUT: %struct_type.base.d: type = struct_type {.base: @Derived.%Base.loc9_22.2 (%Base.370), .d: @Derived.%T.loc8_15.2 (%T)} [symbolic = %struct_type.base.d (constants.%struct_type.base.d.37c)]
  564. // CHECK:STDOUT: %complete_type.loc11_1.2: <witness> = complete_type_witness @Derived.%struct_type.base.d (%struct_type.base.d.37c) [symbolic = %complete_type.loc11_1.2 (constants.%complete_type.8ad)]
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: class {
  567. // CHECK:STDOUT: %Base.ref: %Base.type = name_ref Base, file.%Base.decl [template = constants.%Base.generic]
  568. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc8_15.1 [symbolic = %T.loc8_15.2 (constants.%T)]
  569. // CHECK:STDOUT: %Base.loc9_22.1: type = class_type @Base, @Base(constants.%T) [symbolic = %Base.loc9_22.2 (constants.%Base.370)]
  570. // CHECK:STDOUT: %.loc9: @Derived.%Derived.elem.loc9 (%Derived.elem.8b3) = base_decl %Base.loc9_22.1, element0 [template]
  571. // CHECK:STDOUT: %.loc10_8: @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = field_decl d, element1 [template]
  572. // CHECK:STDOUT: name_binding_decl {
  573. // CHECK:STDOUT: %.loc10_3: @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = var_pattern %.loc10_8
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT: %.var: ref @Derived.%Derived.elem.loc10 (%Derived.elem.6d2) = var <none>
  576. // CHECK:STDOUT: %complete_type.loc11_1.1: <witness> = complete_type_witness %struct_type.base.d.37c [symbolic = %complete_type.loc11_1.2 (constants.%complete_type.8ad)]
  577. // CHECK:STDOUT: complete_type_witness = %complete_type.loc11_1.1
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: !members:
  580. // CHECK:STDOUT: .Self = constants.%Derived.85c
  581. // CHECK:STDOUT: .base = %.loc9
  582. // CHECK:STDOUT: .d = %.loc10_8
  583. // CHECK:STDOUT: extend %Base.loc9_22.1
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: generic fn @AccessMissingBase(%T.loc13_22.1: type) {
  588. // CHECK:STDOUT: %T.loc13_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc13_22.2 (constants.%T)]
  589. // CHECK:STDOUT: %T.patt.loc13_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc13_22.2 (constants.%T.patt)]
  590. // CHECK:STDOUT: %Base.loc13_41.2: type = class_type @Base, @Base(%T.loc13_22.2) [symbolic = %Base.loc13_41.2 (constants.%Base.370)]
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: !definition:
  593. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @AccessMissingBase.%Base.loc13_41.2 (%Base.370) [symbolic = %require_complete (constants.%require_complete.97d)]
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @AccessMissingBase.%Base.loc13_41.2 (%Base.370)) -> @AccessMissingBase.%T.loc13_22.2 (%T) {
  596. // CHECK:STDOUT: !entry:
  597. // CHECK:STDOUT: %x.ref: @AccessMissingBase.%Base.loc13_41.2 (%Base.370) = name_ref x, %x
  598. // CHECK:STDOUT: %nonesuch.ref: <error> = name_ref nonesuch, <error> [template = <error>]
  599. // CHECK:STDOUT: return <error>
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: generic fn @AccessMissingDerived(%T.loc21_25.1: type) {
  604. // CHECK:STDOUT: %T.loc21_25.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc21_25.2 (constants.%T)]
  605. // CHECK:STDOUT: %T.patt.loc21_25.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc21_25.2 (constants.%T.patt)]
  606. // CHECK:STDOUT: %Derived.loc21_47.2: type = class_type @Derived, @Derived(%T.loc21_25.2) [symbolic = %Derived.loc21_47.2 (constants.%Derived.85c)]
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: !definition:
  609. // CHECK:STDOUT: %require_complete.loc21: <witness> = require_complete_type @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) [symbolic = %require_complete.loc21 (constants.%require_complete.5f4)]
  610. // CHECK:STDOUT: %Base: type = class_type @Base, @Base(%T.loc21_25.2) [symbolic = %Base (constants.%Base.370)]
  611. // CHECK:STDOUT: %require_complete.loc26: <witness> = require_complete_type @AccessMissingDerived.%Base (%Base.370) [symbolic = %require_complete.loc26 (constants.%require_complete.97d)]
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: fn[%T.param_patt: type](%x.param_patt: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c)) -> @AccessMissingDerived.%T.loc21_25.2 (%T) {
  614. // CHECK:STDOUT: !entry:
  615. // CHECK:STDOUT: %x.ref: @AccessMissingDerived.%Derived.loc21_47.2 (%Derived.85c) = name_ref x, %x
  616. // CHECK:STDOUT: %nonesuch.ref: <error> = name_ref nonesuch, <error> [template = <error>]
  617. // CHECK:STDOUT: return <error>
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: fn @AccessMissingConcrete(%x.param_patt: %Derived.115) -> %i32 {
  622. // CHECK:STDOUT: !entry:
  623. // CHECK:STDOUT: %x.ref: %Derived.115 = name_ref x, %x
  624. // CHECK:STDOUT: %nonesuch.ref: <error> = name_ref nonesuch, <error> [template = <error>]
  625. // CHECK:STDOUT: return <error>
  626. // CHECK:STDOUT: }
  627. // CHECK:STDOUT:
  628. // CHECK:STDOUT: specific @Base(constants.%T) {
  629. // CHECK:STDOUT: %T.loc4_17.2 => constants.%T
  630. // CHECK:STDOUT: %T.patt.loc4_17.2 => constants.%T
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: !definition:
  633. // CHECK:STDOUT: %require_complete => constants.%require_complete.4ae
  634. // CHECK:STDOUT: %Base => constants.%Base.370
  635. // CHECK:STDOUT: %Base.elem => constants.%Base.elem.9af
  636. // CHECK:STDOUT: %struct_type.b => constants.%struct_type.b.f69
  637. // CHECK:STDOUT: %complete_type.loc6_1.2 => constants.%complete_type.eaf
  638. // CHECK:STDOUT: }
  639. // CHECK:STDOUT:
  640. // CHECK:STDOUT: specific @Base(%T.loc4_17.2) {}
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: specific @Derived(constants.%T) {
  643. // CHECK:STDOUT: %T.loc8_15.2 => constants.%T
  644. // CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%T
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: !definition:
  647. // CHECK:STDOUT: %Base.loc9_22.2 => constants.%Base.370
  648. // CHECK:STDOUT: %require_complete.loc9 => constants.%require_complete.97d
  649. // CHECK:STDOUT: %Derived => constants.%Derived.85c
  650. // CHECK:STDOUT: %Derived.elem.loc9 => constants.%Derived.elem.8b3
  651. // CHECK:STDOUT: %require_complete.loc10 => constants.%require_complete.4ae
  652. // CHECK:STDOUT: %Derived.elem.loc10 => constants.%Derived.elem.6d2
  653. // CHECK:STDOUT: %struct_type.base.d => constants.%struct_type.base.d.37c
  654. // CHECK:STDOUT: %complete_type.loc11_1.2 => constants.%complete_type.8ad
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: specific @Base(@Derived.%T.loc8_15.2) {}
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: specific @Derived(%T.loc8_15.2) {}
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: specific @AccessMissingBase(constants.%T) {
  662. // CHECK:STDOUT: %T.loc13_22.2 => constants.%T
  663. // CHECK:STDOUT: %T.patt.loc13_22.2 => constants.%T
  664. // CHECK:STDOUT: %Base.loc13_41.2 => constants.%Base.370
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: specific @Base(@AccessMissingBase.%T.loc13_22.2) {}
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: specific @AccessMissingDerived(constants.%T) {
  670. // CHECK:STDOUT: %T.loc21_25.2 => constants.%T
  671. // CHECK:STDOUT: %T.patt.loc21_25.2 => constants.%T
  672. // CHECK:STDOUT: %Derived.loc21_47.2 => constants.%Derived.85c
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: specific @Derived(@AccessMissingDerived.%T.loc21_25.2) {}
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: specific @Base(@AccessMissingDerived.%T.loc21_25.2) {}
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: specific @Derived(constants.%i32) {
  680. // CHECK:STDOUT: %T.loc8_15.2 => constants.%i32
  681. // CHECK:STDOUT: %T.patt.loc8_15.2 => constants.%i32
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: !definition:
  684. // CHECK:STDOUT: %Base.loc9_22.2 => constants.%Base.10a
  685. // CHECK:STDOUT: %require_complete.loc9 => constants.%complete_type.ba8
  686. // CHECK:STDOUT: %Derived => constants.%Derived.115
  687. // CHECK:STDOUT: %Derived.elem.loc9 => constants.%Derived.elem.0c4
  688. // CHECK:STDOUT: %require_complete.loc10 => constants.%complete_type.f8a
  689. // CHECK:STDOUT: %Derived.elem.loc10 => constants.%Derived.elem.b58
  690. // CHECK:STDOUT: %struct_type.base.d => constants.%struct_type.base.d.ffa
  691. // CHECK:STDOUT: %complete_type.loc11_1.2 => constants.%complete_type.544
  692. // CHECK:STDOUT: }
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: specific @Base(constants.%i32) {
  695. // CHECK:STDOUT: %T.loc4_17.2 => constants.%i32
  696. // CHECK:STDOUT: %T.patt.loc4_17.2 => constants.%i32
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: !definition:
  699. // CHECK:STDOUT: %require_complete => constants.%complete_type.f8a
  700. // CHECK:STDOUT: %Base => constants.%Base.10a
  701. // CHECK:STDOUT: %Base.elem => constants.%Base.elem.a98
  702. // CHECK:STDOUT: %struct_type.b => constants.%struct_type.b.0a3
  703. // CHECK:STDOUT: %complete_type.loc6_1.2 => constants.%complete_type.ba8
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT: