fail_member_of_let.carbon 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. }
  9. // TODO: Use `:!` here once it is available.
  10. let T: type = Class;
  11. // The class name is required to be written in the same way as in the class
  12. // declaration. An expression that evaluates to the class name is not accepted.
  13. // CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+3]]:4: ERROR: Name `T` not found.
  14. // CHECK:STDERR: fn T.F() {}
  15. // CHECK:STDERR: ^
  16. fn T.F() {}
  17. // CHECK:STDOUT: --- fail_member_of_let.carbon
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: constants {
  20. // CHECK:STDOUT: %Class: type = class_type @Class [template]
  21. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .Class = %Class.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {}
  29. // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class]
  30. // CHECK:STDOUT: %T: type = bind_name T, %Class.ref
  31. // CHECK:STDOUT: %.loc19: <function> = fn_decl @.1 [template] {}
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: class @Class {
  35. // CHECK:STDOUT: %F: <function> = fn_decl @F [template] {
  36. // CHECK:STDOUT: %return.var: ref i32 = var <return slot>
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: !members:
  40. // CHECK:STDOUT: .Self = constants.%Class
  41. // CHECK:STDOUT: .F = %F
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @F() -> i32;
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: fn @.1() {
  47. // CHECK:STDOUT: !entry:
  48. // CHECK:STDOUT: return
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT: