member_inline.carbon 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_inline.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_inline.carbon
  10. class Class(T:! type) {
  11. fn F(n: T) -> T {
  12. return n;
  13. }
  14. }
  15. // CHECK:STDOUT: --- member_inline.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  19. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
  20. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  21. // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
  22. // CHECK:STDOUT: %Class.2: type = class_type @Class, (%T) [symbolic]
  23. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  24. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  25. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: file {
  29. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  30. // CHECK:STDOUT: .Core = %Core
  31. // CHECK:STDOUT: .Class = %Class.decl
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  34. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
  35. // CHECK:STDOUT: %T.loc11_13.1: type = param T
  36. // CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT: }
  39. // CHECK:STDOUT:
  40. // CHECK:STDOUT: class @Class
  41. // CHECK:STDOUT: generic [file.%T.loc11_13.2: type] {
  42. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  43. // CHECK:STDOUT: %T.ref.loc12_11: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T]
  44. // CHECK:STDOUT: %n.loc12_8.1: %T = param n
  45. // CHECK:STDOUT: %n.loc12_8.2: %T = bind_name n, %n.loc12_8.1
  46. // CHECK:STDOUT: %T.ref.loc12_17: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T]
  47. // CHECK:STDOUT: %return.var: ref %T = var <return slot>
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: !members:
  51. // CHECK:STDOUT: .Self = constants.%Class.2
  52. // CHECK:STDOUT: .F = %F.decl
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: fn @F(@Class.%n.loc12_8.2: %T) -> %T
  56. // CHECK:STDOUT: generic [file.%T.loc11_13.2: type] {
  57. // CHECK:STDOUT: !entry:
  58. // CHECK:STDOUT: %n.ref: %T = name_ref n, @Class.%n.loc12_8.2
  59. // CHECK:STDOUT: return %n.ref
  60. // CHECK:STDOUT: }
  61. // CHECK:STDOUT: