base_function_unqualified.carbon 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. base class Base {
  7. fn F();
  8. }
  9. class Derived {
  10. extend base: Base;
  11. fn G() { F(); }
  12. fn H();
  13. }
  14. fn Derived.H() {
  15. F();
  16. }
  17. // CHECK:STDOUT: --- base_function_unqualified.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  21. // CHECK:STDOUT: %F: type = fn_type @F [template]
  22. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  23. // CHECK:STDOUT: %struct.1: F = struct_value () [template]
  24. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  25. // CHECK:STDOUT: %Derived: type = class_type @Derived [template]
  26. // CHECK:STDOUT: %.3: type = ptr_type {} [template]
  27. // CHECK:STDOUT: %.4: type = unbound_element_type Derived, Base [template]
  28. // CHECK:STDOUT: %G: type = fn_type @G [template]
  29. // CHECK:STDOUT: %struct.2: G = struct_value () [template]
  30. // CHECK:STDOUT: %H: type = fn_type @H [template]
  31. // CHECK:STDOUT: %struct.3: H = struct_value () [template]
  32. // CHECK:STDOUT: %.5: type = struct_type {.base: Base} [template]
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: file {
  36. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  37. // CHECK:STDOUT: .Core = %Core
  38. // CHECK:STDOUT: .Base = %Base.decl
  39. // CHECK:STDOUT: .Derived = %Derived.decl
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  42. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {}
  43. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {}
  44. // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {}
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: class @Base {
  48. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: !members:
  51. // CHECK:STDOUT: .Self = constants.%Base
  52. // CHECK:STDOUT: .F = %F.decl
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT:
  55. // CHECK:STDOUT: class @Derived {
  56. // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base]
  57. // CHECK:STDOUT: %.loc12: <unbound element of class Derived> = base_decl Base, element0 [template]
  58. // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {}
  59. // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {}
  60. // CHECK:STDOUT:
  61. // CHECK:STDOUT: !members:
  62. // CHECK:STDOUT: .Self = constants.%Derived
  63. // CHECK:STDOUT: .base = %.loc12
  64. // CHECK:STDOUT: .G = %G.decl
  65. // CHECK:STDOUT: .H = %H.decl
  66. // CHECK:STDOUT: extend name_scope2
  67. // CHECK:STDOUT: }
  68. // CHECK:STDOUT:
  69. // CHECK:STDOUT: fn @F();
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: fn @G() {
  72. // CHECK:STDOUT: !entry:
  73. // CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1]
  74. // CHECK:STDOUT: %F.call: init () = call %F.ref()
  75. // CHECK:STDOUT: return
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: fn @H() {
  79. // CHECK:STDOUT: !entry:
  80. // CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.1]
  81. // CHECK:STDOUT: %F.call: init () = call %F.ref()
  82. // CHECK:STDOUT: return
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT: