a3cfd48c1f4a33aad9d1552ddbe46d44a2436384 710 B

12345678910111213141516171819202122232425262728293031
  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. package ExplorerTest;
  7. // The bodies of member functions are processed after all immediately enclosing
  8. // classes, impl declarations, and interfaces.
  9. class A {
  10. fn F() -> type {
  11. return i32;
  12. }
  13. // OK, resolves to `A.F`.
  14. fn G() -> F() {
  15. return 0;
  16. }
  17. // CHECK:STDERR: COMPILATION ERROR: fail_class_fn_use_before_declaration.carbon:[[@LINE+1]]: 'I' has not been declared yet
  18. fn H() -> I() {
  19. return 0;
  20. }
  21. fn I() -> type {
  22. return i32;
  23. }
  24. }
  25. fn Main() -> i32 {
  26. return 0;
  27. }