fail_abstract.carbon 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  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/fail_abstract.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_abstract.carbon
  10. // --- fail_abstract_field.carbon
  11. library "[[@TEST_NAME]]";
  12. abstract class Abstract {
  13. }
  14. class Contains {
  15. // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE+7]]:10: error: field has abstract type `Abstract` [AbstractTypeInFieldDecl]
  16. // CHECK:STDERR: var a: Abstract;
  17. // CHECK:STDERR: ^~~~~~~~
  18. // CHECK:STDERR: fail_abstract_field.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere]
  19. // CHECK:STDERR: abstract class Abstract {
  20. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  21. // CHECK:STDERR:
  22. var a: Abstract;
  23. }
  24. // --- fail_abstract_var.carbon
  25. library "[[@TEST_NAME]]";
  26. abstract class Abstract {
  27. }
  28. fn Var() {
  29. // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE+7]]:10: error: binding pattern has abstract type `Abstract` in `var` pattern [AbstractTypeInVarPattern]
  30. // CHECK:STDERR: var v: Abstract;
  31. // CHECK:STDERR: ^~~~~~~~
  32. // CHECK:STDERR: fail_abstract_var.carbon:[[@LINE-7]]:1: note: class was declared abstract here [ClassAbstractHere]
  33. // CHECK:STDERR: abstract class Abstract {
  34. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  35. // CHECK:STDERR:
  36. var v: Abstract;
  37. }
  38. // --- abstract_let.carbon
  39. library "[[@TEST_NAME]]";
  40. abstract class Abstract {
  41. }
  42. fn F(a: Abstract) {
  43. let l: Abstract = a;
  44. }
  45. // --- fail_abstract_adapter.carbon
  46. library "[[@TEST_NAME]]";
  47. abstract class Abstract {
  48. }
  49. class Adapter {
  50. // TODO(#4387): This should probably be valid
  51. // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE+7]]:3: error: adapted type `Abstract` is an abstract type [AbstractTypeInAdaptDecl]
  52. // CHECK:STDERR: adapt Abstract;
  53. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  54. // CHECK:STDERR: fail_abstract_adapter.carbon:[[@LINE-8]]:1: note: class was declared abstract here [ClassAbstractHere]
  55. // CHECK:STDERR: abstract class Abstract {
  56. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  57. // CHECK:STDERR:
  58. adapt Abstract;
  59. }
  60. // --- define_and_call_abstract_param.carbon
  61. library "[[@TEST_NAME]]";
  62. abstract class Abstract {
  63. }
  64. fn Param(a: Abstract);
  65. fn Call(p: Abstract) {
  66. Param(p);
  67. }
  68. // --- fail_todo_return_nonabstract_derived.carbon
  69. library "[[@TEST_NAME]]";
  70. abstract class Abstract {
  71. }
  72. class Derived {
  73. extend base: Abstract;
  74. var d: i32;
  75. }
  76. fn Make() -> Derived {
  77. // TODO: This should be valid, and should construct an instance of `partial Abstract` as the base.
  78. // CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE+7]]:10: error: initialization of abstract type `Abstract` [AbstractTypeInInit]
  79. // CHECK:STDERR: return {.base = {.a = 1}, .d = 7};
  80. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  81. // CHECK:STDERR: fail_todo_return_nonabstract_derived.carbon:[[@LINE-14]]:1: note: class was declared abstract here [ClassAbstractHere]
  82. // CHECK:STDERR: abstract class Abstract {
  83. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  84. // CHECK:STDERR:
  85. return {.base = {.a = 1}, .d = 7};
  86. }
  87. // --- fail_return_abstract.carbon
  88. library "[[@TEST_NAME]]";
  89. abstract class Abstract {
  90. }
  91. class Derived {
  92. extend base: Abstract;
  93. var d: i32;
  94. }
  95. fn Return(a: Abstract) -> Abstract {
  96. // TODO: Seems like this would be better off failing with "function returns abstract type" here instead of this \/
  97. // CHECK:STDERR: fail_return_abstract.carbon:[[@LINE+7]]:3: error: initialization of abstract type `Abstract` [AbstractTypeInInit]
  98. // CHECK:STDERR: return a;
  99. // CHECK:STDERR: ^~~~~~~~~
  100. // CHECK:STDERR: fail_return_abstract.carbon:[[@LINE-14]]:1: note: class was declared abstract here [ClassAbstractHere]
  101. // CHECK:STDERR: abstract class Abstract {
  102. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  103. // CHECK:STDERR:
  104. return a;
  105. }
  106. // --- access_abstract_subobject.carbon
  107. library "[[@TEST_NAME]]";
  108. abstract class Abstract {
  109. var a: i32;
  110. }
  111. class Derived {
  112. extend base: Abstract;
  113. var d: i32;
  114. }
  115. fn Access(d: Derived) -> i32 {
  116. return d.base.a;
  117. }
  118. // --- abstract_let_temporary.carbon
  119. library "[[@TEST_NAME]]";
  120. abstract class Abstract {
  121. }
  122. fn F() {
  123. let l: Abstract = {};
  124. }
  125. // --- fail_call_abstract_return.carbon
  126. library "[[@TEST_NAME]]";
  127. abstract class Abstract {
  128. }
  129. fn ReturnAbstract() -> Abstract;
  130. fn CallReturnAbstract() {
  131. // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE+10]]:3: error: function returns abstract type `Abstract` [AbstractTypeInFunctionReturnType]
  132. // CHECK:STDERR: ReturnAbstract();
  133. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  134. // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:1: note: class was declared abstract here [ClassAbstractHere]
  135. // CHECK:STDERR: abstract class Abstract {
  136. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  137. // CHECK:STDERR: fail_call_abstract_return.carbon:[[@LINE-9]]:21: note: return type declared here [IncompleteReturnTypeHere]
  138. // CHECK:STDERR: fn ReturnAbstract() -> Abstract;
  139. // CHECK:STDERR: ^~~~~~~~~~~
  140. // CHECK:STDERR:
  141. ReturnAbstract();
  142. }
  143. // CHECK:STDOUT: --- fail_abstract_field.carbon
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: constants {
  146. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  147. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  148. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  149. // CHECK:STDOUT: %Contains: type = class_type @Contains [template]
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT:
  152. // CHECK:STDOUT: imports {
  153. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  154. // CHECK:STDOUT: import Core//prelude
  155. // CHECK:STDOUT: import Core//prelude/...
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: file {
  160. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  161. // CHECK:STDOUT: .Core = imports.%Core
  162. // CHECK:STDOUT: .Abstract = %Abstract.decl
  163. // CHECK:STDOUT: .Contains = %Contains.decl
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %Core.import = import Core
  166. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  167. // CHECK:STDOUT: %Contains.decl: type = class_decl @Contains [template = constants.%Contains] {} {}
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: class @Abstract {
  171. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  172. // CHECK:STDOUT: complete_type_witness = %complete_type
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: !members:
  175. // CHECK:STDOUT: .Self = constants.%Abstract
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: class @Contains {
  179. // CHECK:STDOUT: %.loc15_8: <error> = field_decl a, element0 [template]
  180. // CHECK:STDOUT: name_binding_decl {
  181. // CHECK:STDOUT: %.loc15_3: <error> = var_pattern %.loc15_8
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT: %.var: ref <error> = var <none>
  184. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness <error> [template = <error>]
  185. // CHECK:STDOUT: complete_type_witness = %complete_type
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !members:
  188. // CHECK:STDOUT: .Self = constants.%Contains
  189. // CHECK:STDOUT: .a = %.loc15_8
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: --- fail_abstract_var.carbon
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: constants {
  195. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  196. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  197. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  198. // CHECK:STDOUT: %Var.type: type = fn_type @Var [template]
  199. // CHECK:STDOUT: %Var: %Var.type = struct_value () [template]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: imports {
  203. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  204. // CHECK:STDOUT: import Core//prelude
  205. // CHECK:STDOUT: import Core//prelude/...
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: file {
  210. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  211. // CHECK:STDOUT: .Core = imports.%Core
  212. // CHECK:STDOUT: .Abstract = %Abstract.decl
  213. // CHECK:STDOUT: .Var = %Var.decl
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT: %Core.import = import Core
  216. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  217. // CHECK:STDOUT: %Var.decl: %Var.type = fn_decl @Var [template = constants.%Var] {} {}
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: class @Abstract {
  221. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  222. // CHECK:STDOUT: complete_type_witness = %complete_type
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !members:
  225. // CHECK:STDOUT: .Self = constants.%Abstract
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: fn @Var() {
  229. // CHECK:STDOUT: !entry:
  230. // CHECK:STDOUT: name_binding_decl {
  231. // CHECK:STDOUT: %v.patt: <error> = binding_pattern v
  232. // CHECK:STDOUT: %.loc15: <error> = var_pattern %v.patt
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %v.var: ref <error> = var v
  235. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  236. // CHECK:STDOUT: %v: <error> = bind_name v, <error>
  237. // CHECK:STDOUT: return
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: --- abstract_let.carbon
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: constants {
  243. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  244. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  245. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  246. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  247. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: imports {
  251. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  252. // CHECK:STDOUT: import Core//prelude
  253. // CHECK:STDOUT: import Core//prelude/...
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: file {
  258. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  259. // CHECK:STDOUT: .Core = imports.%Core
  260. // CHECK:STDOUT: .Abstract = %Abstract.decl
  261. // CHECK:STDOUT: .F = %F.decl
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT: %Core.import = import Core
  264. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  265. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  266. // CHECK:STDOUT: %a.patt: %Abstract = binding_pattern a
  267. // CHECK:STDOUT: %a.param_patt: %Abstract = value_param_pattern %a.patt, runtime_param0
  268. // CHECK:STDOUT: } {
  269. // CHECK:STDOUT: %a.param: %Abstract = value_param runtime_param0
  270. // CHECK:STDOUT: %Abstract.ref.loc7: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  271. // CHECK:STDOUT: %a: %Abstract = bind_name a, %a.param
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: class @Abstract {
  276. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  277. // CHECK:STDOUT: complete_type_witness = %complete_type
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: !members:
  280. // CHECK:STDOUT: .Self = constants.%Abstract
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: fn @F(%a.param_patt: %Abstract) {
  284. // CHECK:STDOUT: !entry:
  285. // CHECK:STDOUT: name_binding_decl {
  286. // CHECK:STDOUT: %l.patt: %Abstract = binding_pattern l
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT: %a.ref: %Abstract = name_ref a, %a
  289. // CHECK:STDOUT: %Abstract.ref.loc8: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  290. // CHECK:STDOUT: %l: %Abstract = bind_name l, <error>
  291. // CHECK:STDOUT: return
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: --- fail_abstract_adapter.carbon
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: constants {
  297. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  298. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  299. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  300. // CHECK:STDOUT: %Adapter: type = class_type @Adapter [template]
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: imports {
  304. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  305. // CHECK:STDOUT: import Core//prelude
  306. // CHECK:STDOUT: import Core//prelude/...
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: file {
  311. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  312. // CHECK:STDOUT: .Core = imports.%Core
  313. // CHECK:STDOUT: .Abstract = %Abstract.decl
  314. // CHECK:STDOUT: .Adapter = %Adapter.decl
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT: %Core.import = import Core
  317. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  318. // CHECK:STDOUT: %Adapter.decl: type = class_decl @Adapter [template = constants.%Adapter] {} {}
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: class @Abstract {
  322. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  323. // CHECK:STDOUT: complete_type_witness = %complete_type
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: !members:
  326. // CHECK:STDOUT: .Self = constants.%Abstract
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: class @Adapter {
  330. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  331. // CHECK:STDOUT: adapt_decl <error> [template]
  332. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness <error> [template = <error>]
  333. // CHECK:STDOUT: complete_type_witness = %complete_type
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: !members:
  336. // CHECK:STDOUT: .Self = constants.%Adapter
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: --- define_and_call_abstract_param.carbon
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: constants {
  342. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  343. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  344. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  345. // CHECK:STDOUT: %Param.type: type = fn_type @Param [template]
  346. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  347. // CHECK:STDOUT: %Param: %Param.type = struct_value () [template]
  348. // CHECK:STDOUT: %Call.type: type = fn_type @Call [template]
  349. // CHECK:STDOUT: %Call: %Call.type = struct_value () [template]
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: imports {
  353. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  354. // CHECK:STDOUT: import Core//prelude
  355. // CHECK:STDOUT: import Core//prelude/...
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: file {
  360. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  361. // CHECK:STDOUT: .Core = imports.%Core
  362. // CHECK:STDOUT: .Abstract = %Abstract.decl
  363. // CHECK:STDOUT: .Param = %Param.decl
  364. // CHECK:STDOUT: .Call = %Call.decl
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT: %Core.import = import Core
  367. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  368. // CHECK:STDOUT: %Param.decl: %Param.type = fn_decl @Param [template = constants.%Param] {
  369. // CHECK:STDOUT: %a.patt: %Abstract = binding_pattern a
  370. // CHECK:STDOUT: %a.param_patt: %Abstract = value_param_pattern %a.patt, runtime_param0
  371. // CHECK:STDOUT: } {
  372. // CHECK:STDOUT: %a.param: %Abstract = value_param runtime_param0
  373. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  374. // CHECK:STDOUT: %a: %Abstract = bind_name a, %a.param
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [template = constants.%Call] {
  377. // CHECK:STDOUT: %p.patt: %Abstract = binding_pattern p
  378. // CHECK:STDOUT: %p.param_patt: %Abstract = value_param_pattern %p.patt, runtime_param0
  379. // CHECK:STDOUT: } {
  380. // CHECK:STDOUT: %p.param: %Abstract = value_param runtime_param0
  381. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  382. // CHECK:STDOUT: %p: %Abstract = bind_name p, %p.param
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT: }
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: class @Abstract {
  387. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  388. // CHECK:STDOUT: complete_type_witness = %complete_type
  389. // CHECK:STDOUT:
  390. // CHECK:STDOUT: !members:
  391. // CHECK:STDOUT: .Self = constants.%Abstract
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT:
  394. // CHECK:STDOUT: fn @Param(%a.param_patt: %Abstract);
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: fn @Call(%p.param_patt: %Abstract) {
  397. // CHECK:STDOUT: !entry:
  398. // CHECK:STDOUT: %Param.ref: %Param.type = name_ref Param, file.%Param.decl [template = constants.%Param]
  399. // CHECK:STDOUT: %p.ref: %Abstract = name_ref p, %p
  400. // CHECK:STDOUT: %Param.call: init %empty_tuple.type = call %Param.ref(<error>)
  401. // CHECK:STDOUT: return
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: --- fail_todo_return_nonabstract_derived.carbon
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: constants {
  407. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  408. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  409. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  410. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  411. // CHECK:STDOUT: %Derived.elem.513: type = unbound_element_type %Derived, %Abstract [template]
  412. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  413. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  414. // CHECK:STDOUT: %Derived.elem.344: type = unbound_element_type %Derived, %i32 [template]
  415. // CHECK:STDOUT: %struct_type.base.d.c44: type = struct_type {.base: %Abstract, .d: %i32} [template]
  416. // CHECK:STDOUT: %complete_type.32a: <witness> = complete_type_witness %struct_type.base.d.c44 [template]
  417. // CHECK:STDOUT: %Make.type: type = fn_type @Make [template]
  418. // CHECK:STDOUT: %Make: %Make.type = struct_value () [template]
  419. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template]
  420. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: Core.IntLiteral} [template]
  421. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template]
  422. // CHECK:STDOUT: %struct_type.base.d.9c6: type = struct_type {.base: %struct_type.a, .d: Core.IntLiteral} [template]
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: imports {
  426. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  427. // CHECK:STDOUT: .Int = %Core.Int
  428. // CHECK:STDOUT: import Core//prelude
  429. // CHECK:STDOUT: import Core//prelude/...
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: file {
  434. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  435. // CHECK:STDOUT: .Core = imports.%Core
  436. // CHECK:STDOUT: .Abstract = %Abstract.decl
  437. // CHECK:STDOUT: .Derived = %Derived.decl
  438. // CHECK:STDOUT: .Make = %Make.decl
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: %Core.import = import Core
  441. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  442. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  443. // CHECK:STDOUT: %Make.decl: %Make.type = fn_decl @Make [template = constants.%Make] {
  444. // CHECK:STDOUT: %return.patt: %Derived = return_slot_pattern
  445. // CHECK:STDOUT: %return.param_patt: %Derived = out_param_pattern %return.patt, runtime_param0
  446. // CHECK:STDOUT: } {
  447. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived]
  448. // CHECK:STDOUT: %return.param: ref %Derived = out_param runtime_param0
  449. // CHECK:STDOUT: %return: ref %Derived = return_slot %return.param
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT: }
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: class @Abstract {
  454. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  455. // CHECK:STDOUT: complete_type_witness = %complete_type
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: !members:
  458. // CHECK:STDOUT: .Self = constants.%Abstract
  459. // CHECK:STDOUT: }
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: class @Derived {
  462. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  463. // CHECK:STDOUT: %.loc8: %Derived.elem.513 = base_decl %Abstract.ref, element0 [template]
  464. // CHECK:STDOUT: %.loc10_8: %Derived.elem.344 = field_decl d, element1 [template]
  465. // CHECK:STDOUT: name_binding_decl {
  466. // CHECK:STDOUT: %.loc10_3: %Derived.elem.344 = var_pattern %.loc10_8
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT: %.var: ref %Derived.elem.344 = var <none>
  469. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.d.c44 [template = constants.%complete_type.32a]
  470. // CHECK:STDOUT: complete_type_witness = %complete_type
  471. // CHECK:STDOUT:
  472. // CHECK:STDOUT: !members:
  473. // CHECK:STDOUT: .Self = constants.%Derived
  474. // CHECK:STDOUT: .base = %.loc8
  475. // CHECK:STDOUT: .d = %.loc10_8
  476. // CHECK:STDOUT: extend %Abstract.ref
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT:
  479. // CHECK:STDOUT: fn @Make() -> %return.param_patt: %Derived {
  480. // CHECK:STDOUT: !entry:
  481. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [template = constants.%int_1]
  482. // CHECK:STDOUT: %.loc22_26: %struct_type.a = struct_literal (%int_1)
  483. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template = constants.%int_7]
  484. // CHECK:STDOUT: %.loc22_35: %struct_type.base.d.9c6 = struct_literal (%.loc22_26, %int_7)
  485. // CHECK:STDOUT: return <error> to %return
  486. // CHECK:STDOUT: }
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: --- fail_return_abstract.carbon
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: constants {
  491. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  492. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  493. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [template]
  494. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  495. // CHECK:STDOUT: %Derived.elem.513: type = unbound_element_type %Derived, %Abstract [template]
  496. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  497. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  498. // CHECK:STDOUT: %Derived.elem.344: type = unbound_element_type %Derived, %i32 [template]
  499. // CHECK:STDOUT: %struct_type.base.d: type = struct_type {.base: %Abstract, .d: %i32} [template]
  500. // CHECK:STDOUT: %complete_type.32a: <witness> = complete_type_witness %struct_type.base.d [template]
  501. // CHECK:STDOUT: %Return.type: type = fn_type @Return [template]
  502. // CHECK:STDOUT: %Return: %Return.type = struct_value () [template]
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: imports {
  506. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  507. // CHECK:STDOUT: .Int = %Core.Int
  508. // CHECK:STDOUT: import Core//prelude
  509. // CHECK:STDOUT: import Core//prelude/...
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: file {
  514. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  515. // CHECK:STDOUT: .Core = imports.%Core
  516. // CHECK:STDOUT: .Abstract = %Abstract.decl
  517. // CHECK:STDOUT: .Derived = %Derived.decl
  518. // CHECK:STDOUT: .Return = %Return.decl
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: %Core.import = import Core
  521. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  522. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  523. // CHECK:STDOUT: %Return.decl: %Return.type = fn_decl @Return [template = constants.%Return] {
  524. // CHECK:STDOUT: %a.patt: %Abstract = binding_pattern a
  525. // CHECK:STDOUT: %a.param_patt: %Abstract = value_param_pattern %a.patt, runtime_param0
  526. // CHECK:STDOUT: %return.patt: %Abstract = return_slot_pattern
  527. // CHECK:STDOUT: %return.param_patt: %Abstract = out_param_pattern %return.patt, runtime_param1
  528. // CHECK:STDOUT: } {
  529. // CHECK:STDOUT: %Abstract.ref.loc13_27: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  530. // CHECK:STDOUT: %a.param: %Abstract = value_param runtime_param0
  531. // CHECK:STDOUT: %Abstract.ref.loc13_14: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  532. // CHECK:STDOUT: %a: %Abstract = bind_name a, %a.param
  533. // CHECK:STDOUT: %return.param: ref %Abstract = out_param runtime_param1
  534. // CHECK:STDOUT: %return: ref %Abstract = return_slot %return.param
  535. // CHECK:STDOUT: }
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: class @Abstract {
  539. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type.357]
  540. // CHECK:STDOUT: complete_type_witness = %complete_type
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: !members:
  543. // CHECK:STDOUT: .Self = constants.%Abstract
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: class @Derived {
  547. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  548. // CHECK:STDOUT: %.loc8: %Derived.elem.513 = base_decl %Abstract.ref, element0 [template]
  549. // CHECK:STDOUT: %.loc10_8: %Derived.elem.344 = field_decl d, element1 [template]
  550. // CHECK:STDOUT: name_binding_decl {
  551. // CHECK:STDOUT: %.loc10_3: %Derived.elem.344 = var_pattern %.loc10_8
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT: %.var: ref %Derived.elem.344 = var <none>
  554. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.d [template = constants.%complete_type.32a]
  555. // CHECK:STDOUT: complete_type_witness = %complete_type
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: !members:
  558. // CHECK:STDOUT: .Self = constants.%Derived
  559. // CHECK:STDOUT: .base = %.loc8
  560. // CHECK:STDOUT: .d = %.loc10_8
  561. // CHECK:STDOUT: extend %Abstract.ref
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: fn @Return(%a.param_patt: %Abstract) -> %return.param_patt: %Abstract {
  565. // CHECK:STDOUT: !entry:
  566. // CHECK:STDOUT: %a.ref: %Abstract = name_ref a, %a
  567. // CHECK:STDOUT: return <error> to %return
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: --- access_abstract_subobject.carbon
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: constants {
  573. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  574. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  575. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  576. // CHECK:STDOUT: %Abstract.elem: type = unbound_element_type %Abstract, %i32 [template]
  577. // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [template]
  578. // CHECK:STDOUT: %complete_type.fd7: <witness> = complete_type_witness %struct_type.a [template]
  579. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  580. // CHECK:STDOUT: %Derived.elem.513: type = unbound_element_type %Derived, %Abstract [template]
  581. // CHECK:STDOUT: %Derived.elem.344: type = unbound_element_type %Derived, %i32 [template]
  582. // CHECK:STDOUT: %struct_type.base.d.c44: type = struct_type {.base: %Abstract, .d: %i32} [template]
  583. // CHECK:STDOUT: %complete_type.32a: <witness> = complete_type_witness %struct_type.base.d.c44 [template]
  584. // CHECK:STDOUT: %Access.type: type = fn_type @Access [template]
  585. // CHECK:STDOUT: %Access: %Access.type = struct_value () [template]
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: imports {
  589. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  590. // CHECK:STDOUT: .Int = %Core.Int
  591. // CHECK:STDOUT: import Core//prelude
  592. // CHECK:STDOUT: import Core//prelude/...
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: file {
  597. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  598. // CHECK:STDOUT: .Core = imports.%Core
  599. // CHECK:STDOUT: .Abstract = %Abstract.decl
  600. // CHECK:STDOUT: .Derived = %Derived.decl
  601. // CHECK:STDOUT: .Access = %Access.decl
  602. // CHECK:STDOUT: }
  603. // CHECK:STDOUT: %Core.import = import Core
  604. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  605. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} {}
  606. // CHECK:STDOUT: %Access.decl: %Access.type = fn_decl @Access [template = constants.%Access] {
  607. // CHECK:STDOUT: %d.patt: %Derived = binding_pattern d
  608. // CHECK:STDOUT: %d.param_patt: %Derived = value_param_pattern %d.patt, runtime_param0
  609. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  610. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, runtime_param1
  611. // CHECK:STDOUT: } {
  612. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  613. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  614. // CHECK:STDOUT: %d.param: %Derived = value_param runtime_param0
  615. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived]
  616. // CHECK:STDOUT: %d: %Derived = bind_name d, %d.param
  617. // CHECK:STDOUT: %return.param: ref %i32 = out_param runtime_param1
  618. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT:
  622. // CHECK:STDOUT: class @Abstract {
  623. // CHECK:STDOUT: %.loc5_8: %Abstract.elem = field_decl a, element0 [template]
  624. // CHECK:STDOUT: name_binding_decl {
  625. // CHECK:STDOUT: %.loc5_3: %Abstract.elem = var_pattern %.loc5_8
  626. // CHECK:STDOUT: }
  627. // CHECK:STDOUT: %.var: ref %Abstract.elem = var <none>
  628. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.a [template = constants.%complete_type.fd7]
  629. // CHECK:STDOUT: complete_type_witness = %complete_type
  630. // CHECK:STDOUT:
  631. // CHECK:STDOUT: !members:
  632. // CHECK:STDOUT: .Self = constants.%Abstract
  633. // CHECK:STDOUT: .a = %.loc5_8
  634. // CHECK:STDOUT: }
  635. // CHECK:STDOUT:
  636. // CHECK:STDOUT: class @Derived {
  637. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  638. // CHECK:STDOUT: %.loc9: %Derived.elem.513 = base_decl %Abstract.ref, element0 [template]
  639. // CHECK:STDOUT: %.loc11_8: %Derived.elem.344 = field_decl d, element1 [template]
  640. // CHECK:STDOUT: name_binding_decl {
  641. // CHECK:STDOUT: %.loc11_3: %Derived.elem.344 = var_pattern %.loc11_8
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT: %.var: ref %Derived.elem.344 = var <none>
  644. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.base.d.c44 [template = constants.%complete_type.32a]
  645. // CHECK:STDOUT: complete_type_witness = %complete_type
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: !members:
  648. // CHECK:STDOUT: .Self = constants.%Derived
  649. // CHECK:STDOUT: .base = %.loc9
  650. // CHECK:STDOUT: .d = %.loc11_8
  651. // CHECK:STDOUT: extend %Abstract.ref
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: fn @Access(%d.param_patt: %Derived) -> %i32 {
  655. // CHECK:STDOUT: !entry:
  656. // CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
  657. // CHECK:STDOUT: %base.ref: %Derived.elem.513 = name_ref base, @Derived.%.loc9 [template = @Derived.%.loc9]
  658. // CHECK:STDOUT: %.loc15: ref %Abstract = class_element_access %d.ref, element0
  659. // CHECK:STDOUT: %a.ref: <error> = name_ref a, <error> [template = <error>]
  660. // CHECK:STDOUT: return <error>
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: --- abstract_let_temporary.carbon
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: constants {
  666. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  667. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  668. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  669. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  670. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: imports {
  674. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  675. // CHECK:STDOUT: import Core//prelude
  676. // CHECK:STDOUT: import Core//prelude/...
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: file {
  681. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  682. // CHECK:STDOUT: .Core = imports.%Core
  683. // CHECK:STDOUT: .Abstract = %Abstract.decl
  684. // CHECK:STDOUT: .F = %F.decl
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT: %Core.import = import Core
  687. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  688. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: class @Abstract {
  692. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  693. // CHECK:STDOUT: complete_type_witness = %complete_type
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: !members:
  696. // CHECK:STDOUT: .Self = constants.%Abstract
  697. // CHECK:STDOUT: }
  698. // CHECK:STDOUT:
  699. // CHECK:STDOUT: fn @F() {
  700. // CHECK:STDOUT: !entry:
  701. // CHECK:STDOUT: name_binding_decl {
  702. // CHECK:STDOUT: %l.patt: %Abstract = binding_pattern l
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: %.loc8: %empty_struct_type = struct_literal ()
  705. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  706. // CHECK:STDOUT: %l: %Abstract = bind_name l, <error>
  707. // CHECK:STDOUT: return
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: --- fail_call_abstract_return.carbon
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: constants {
  713. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  714. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  715. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  716. // CHECK:STDOUT: %ReturnAbstract.type: type = fn_type @ReturnAbstract [template]
  717. // CHECK:STDOUT: %ReturnAbstract: %ReturnAbstract.type = struct_value () [template]
  718. // CHECK:STDOUT: %CallReturnAbstract.type: type = fn_type @CallReturnAbstract [template]
  719. // CHECK:STDOUT: %CallReturnAbstract: %CallReturnAbstract.type = struct_value () [template]
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: imports {
  723. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  724. // CHECK:STDOUT: import Core//prelude
  725. // CHECK:STDOUT: import Core//prelude/...
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT: }
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: file {
  730. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  731. // CHECK:STDOUT: .Core = imports.%Core
  732. // CHECK:STDOUT: .Abstract = %Abstract.decl
  733. // CHECK:STDOUT: .ReturnAbstract = %ReturnAbstract.decl
  734. // CHECK:STDOUT: .CallReturnAbstract = %CallReturnAbstract.decl
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT: %Core.import = import Core
  737. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  738. // CHECK:STDOUT: %ReturnAbstract.decl: %ReturnAbstract.type = fn_decl @ReturnAbstract [template = constants.%ReturnAbstract] {
  739. // CHECK:STDOUT: %return.patt: %Abstract = return_slot_pattern
  740. // CHECK:STDOUT: %return.param_patt: %Abstract = out_param_pattern %return.patt, runtime_param0
  741. // CHECK:STDOUT: } {
  742. // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract]
  743. // CHECK:STDOUT: %return.param: ref %Abstract = out_param runtime_param0
  744. // CHECK:STDOUT: %return: ref %Abstract = return_slot %return.param
  745. // CHECK:STDOUT: }
  746. // CHECK:STDOUT: %CallReturnAbstract.decl: %CallReturnAbstract.type = fn_decl @CallReturnAbstract [template = constants.%CallReturnAbstract] {} {}
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: class @Abstract {
  750. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  751. // CHECK:STDOUT: complete_type_witness = %complete_type
  752. // CHECK:STDOUT:
  753. // CHECK:STDOUT: !members:
  754. // CHECK:STDOUT: .Self = constants.%Abstract
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT:
  757. // CHECK:STDOUT: fn @ReturnAbstract() -> %Abstract;
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: fn @CallReturnAbstract() {
  760. // CHECK:STDOUT: !entry:
  761. // CHECK:STDOUT: %ReturnAbstract.ref: %ReturnAbstract.type = name_ref ReturnAbstract, file.%ReturnAbstract.decl [template = constants.%ReturnAbstract]
  762. // CHECK:STDOUT: %ReturnAbstract.call: init <error> = call %ReturnAbstract.ref()
  763. // CHECK:STDOUT: return
  764. // CHECK:STDOUT: }
  765. // CHECK:STDOUT: