fail_member_of_let.carbon 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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+6]]:6: ERROR: Declaration qualifiers are only allowed for entities that provide a scope.
  14. // CHECK:STDERR: fn T.F() {}
  15. // CHECK:STDERR: ^
  16. // CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+3]]:4: Non-scope entity referenced here.
  17. // CHECK:STDERR: fn T.F() {}
  18. // CHECK:STDERR: ^
  19. fn T.F() {}
  20. // CHECK:STDOUT: constants {
  21. // CHECK:STDOUT: %.loc9: type = struct_type {}
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file "fail_member_of_let.carbon" {
  25. // CHECK:STDOUT: class_decl @Class, ()
  26. // CHECK:STDOUT: %Class: type = class_type @Class
  27. // CHECK:STDOUT: %Class.ref: type = name_reference Class, %Class
  28. // CHECK:STDOUT: %T: type = bind_name T, %Class.ref
  29. // CHECK:STDOUT: %.loc22: <function> = fn_decl @.1
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: class @Class {
  33. // CHECK:STDOUT: %F: <function> = fn_decl @F
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: !members:
  36. // CHECK:STDOUT: .F = %F
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: fn @F() -> i32;
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: fn @.1() {
  42. // CHECK:STDOUT: !entry:
  43. // CHECK:STDOUT: return
  44. // CHECK:STDOUT: }