redeclaration.carbon 2.2 KB

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