redeclaration.carbon 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. class Class;
  7. class Class {
  8. fn F[self: Self](b: bool);
  9. }
  10. fn Class.F[self: Self](b: bool) {}
  11. // CHECK:STDOUT: --- redeclaration.carbon
  12. // CHECK:STDOUT:
  13. // CHECK:STDOUT: constants {
  14. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  15. // CHECK:STDOUT: %F: type = fn_type @F [template]
  16. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  17. // CHECK:STDOUT: %struct: F = struct_value () [template]
  18. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  19. // CHECK:STDOUT: %.3: type = ptr_type {} [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .Core = %Core
  25. // CHECK:STDOUT: .Class = %Class.decl.loc7
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  28. // CHECK:STDOUT: %Class.decl.loc7: type = class_decl @Class [template = constants.%Class] {}
  29. // CHECK:STDOUT: %Class.decl.loc9: type = class_decl @Class [template = constants.%Class] {}
  30. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
  31. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class]
  32. // CHECK:STDOUT: %self.loc13_12.1: Class = param self
  33. // CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc13_12.1
  34. // CHECK:STDOUT: %b.loc13_24.1: bool = param b
  35. // CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc13_24.1
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: class @Class {
  40. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
  41. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class]
  42. // CHECK:STDOUT: %self.loc10_8.1: Class = param self
  43. // CHECK:STDOUT: %self.loc10_8.2: Class = bind_name self, %self.loc10_8.1
  44. // CHECK:STDOUT: %b.loc10_20.1: bool = param b
  45. // CHECK:STDOUT: %b.loc10_20.2: bool = bind_name b, %b.loc10_20.1
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: !members:
  49. // CHECK:STDOUT: .Self = constants.%Class
  50. // CHECK:STDOUT: .F = %F.decl
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: fn @F[%self: Class](%b: bool) {
  54. // CHECK:STDOUT: !entry:
  55. // CHECK:STDOUT: return
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: