reenter_scope.carbon 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. fn F() -> i32;
  8. fn G() -> i32;
  9. }
  10. fn Class.F() -> i32 {
  11. Self.G();
  12. return G();
  13. }
  14. // CHECK:STDOUT: --- reenter_scope.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  18. // CHECK:STDOUT: %F: type = fn_type @F [template]
  19. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  20. // CHECK:STDOUT: %struct.1: F = struct_value () [template]
  21. // CHECK:STDOUT: %G: type = fn_type @G [template]
  22. // CHECK:STDOUT: %struct.2: G = struct_value () [template]
  23. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .Core = %Core
  29. // CHECK:STDOUT: .Class = %Class.decl
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  32. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
  33. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
  34. // CHECK:STDOUT: @F.%return: ref i32 = var <return slot>
  35. // CHECK:STDOUT: }
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: class @Class {
  39. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {
  40. // CHECK:STDOUT: %return.var.loc8: ref i32 = var <return slot>
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {
  43. // CHECK:STDOUT: %return.var.loc9: ref i32 = var <return slot>
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: !members:
  47. // CHECK:STDOUT: .Self = constants.%Class
  48. // CHECK:STDOUT: .F = %F.decl
  49. // CHECK:STDOUT: .G = %G.decl
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: fn @F() -> i32 {
  53. // CHECK:STDOUT: !entry:
  54. // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class]
  55. // CHECK:STDOUT: %G.ref.loc13: G = name_ref G, @Class.%G.decl [template = constants.%struct.2]
  56. // CHECK:STDOUT: %G.call.loc13: init i32 = call %G.ref.loc13()
  57. // CHECK:STDOUT: %G.ref.loc14: G = name_ref G, @Class.%G.decl [template = constants.%struct.2]
  58. // CHECK:STDOUT: %G.call.loc14: init i32 = call %G.ref.loc14()
  59. // CHECK:STDOUT: %.loc14_13.1: i32 = value_of_initializer %G.call.loc14
  60. // CHECK:STDOUT: %.loc14_13.2: i32 = converted %G.call.loc14, %.loc14_13.1
  61. // CHECK:STDOUT: return %.loc14_13.2
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT:
  64. // CHECK:STDOUT: fn @G() -> i32;
  65. // CHECK:STDOUT: