fail_member_of_let.carbon 1.3 KB

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