fail_member_of_let.carbon 1.2 KB

123456789101112131415161718192021222324252627
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon
  10. class Class {
  11. fn F() -> ();
  12. }
  13. // TODO: Use `:!` here once it is available.
  14. let T: type = Class;
  15. // The class name is required to be written in the same way as in the class
  16. // declaration. An expression that evaluates to the class name is not accepted.
  17. // CHECK:STDERR: fail_member_of_let.carbon:[[@LINE+7]]:4: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope]
  18. // CHECK:STDERR: fn T.F() {}
  19. // CHECK:STDERR: ^
  20. // CHECK:STDERR: fail_member_of_let.carbon:[[@LINE-7]]:5: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity]
  21. // CHECK:STDERR: let T: type = Class;
  22. // CHECK:STDERR: ^
  23. // CHECK:STDERR:
  24. fn T.F() {}