virtual_modifiers.carbon 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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/virtual_modifiers.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/virtual_modifiers.carbon
  10. base class Base {
  11. virtual fn H();
  12. impl fn I();
  13. }
  14. abstract class Abstract {
  15. abstract fn J();
  16. virtual fn K();
  17. impl fn L();
  18. }
  19. // CHECK:STDOUT: --- virtual_modifiers.carbon
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: constants {
  22. // CHECK:STDOUT: %Base: type = class_type @Base [template]
  23. // CHECK:STDOUT: %H.type: type = fn_type @H [template]
  24. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  25. // CHECK:STDOUT: %H: %H.type = struct_value () [template]
  26. // CHECK:STDOUT: %I.type: type = fn_type @I [template]
  27. // CHECK:STDOUT: %I: %I.type = struct_value () [template]
  28. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  29. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  30. // CHECK:STDOUT: %Abstract: type = class_type @Abstract [template]
  31. // CHECK:STDOUT: %J.type: type = fn_type @J [template]
  32. // CHECK:STDOUT: %J: %J.type = struct_value () [template]
  33. // CHECK:STDOUT: %K.type: type = fn_type @K [template]
  34. // CHECK:STDOUT: %K: %K.type = struct_value () [template]
  35. // CHECK:STDOUT: %L.type: type = fn_type @L [template]
  36. // CHECK:STDOUT: %L: %L.type = struct_value () [template]
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: imports {
  40. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  41. // CHECK:STDOUT: import Core//prelude
  42. // CHECK:STDOUT: import Core//prelude/operators
  43. // CHECK:STDOUT: import Core//prelude/types
  44. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  45. // CHECK:STDOUT: import Core//prelude/operators/as
  46. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  47. // CHECK:STDOUT: import Core//prelude/operators/comparison
  48. // CHECK:STDOUT: import Core//prelude/types/bool
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: file {
  53. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  54. // CHECK:STDOUT: .Core = imports.%Core
  55. // CHECK:STDOUT: .Base = %Base.decl
  56. // CHECK:STDOUT: .Abstract = %Abstract.decl
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: %Core.import = import Core
  59. // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} {}
  60. // CHECK:STDOUT: %Abstract.decl: type = class_decl @Abstract [template = constants.%Abstract] {} {}
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: class @Base {
  64. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {} {}
  65. // CHECK:STDOUT: %I.decl: %I.type = fn_decl @I [template = constants.%I] {} {}
  66. // CHECK:STDOUT: %.loc16: <witness> = complete_type_witness %.2 [template = constants.%.3]
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: !members:
  69. // CHECK:STDOUT: .Self = constants.%Base
  70. // CHECK:STDOUT: .H = %H.decl
  71. // CHECK:STDOUT: .I = %I.decl
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT:
  74. // CHECK:STDOUT: class @Abstract {
  75. // CHECK:STDOUT: %J.decl: %J.type = fn_decl @J [template = constants.%J] {} {}
  76. // CHECK:STDOUT: %K.decl: %K.type = fn_decl @K [template = constants.%K] {} {}
  77. // CHECK:STDOUT: %L.decl: %L.type = fn_decl @L [template = constants.%L] {} {}
  78. // CHECK:STDOUT: %.loc24: <witness> = complete_type_witness %.2 [template = constants.%.3]
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: !members:
  81. // CHECK:STDOUT: .Self = constants.%Abstract
  82. // CHECK:STDOUT: .J = %J.decl
  83. // CHECK:STDOUT: .K = %K.decl
  84. // CHECK:STDOUT: .L = %L.decl
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: virtual fn @H();
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: impl fn @I();
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: abstract fn @J();
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: virtual fn @K();
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: impl fn @L();
  96. // CHECK:STDOUT: