fail_todo_generic_default_fn.carbon 1.3 KB

12345678910111213141516171819202122232425
  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/interface/fail_todo_generic_default_fn.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_generic_default_fn.carbon
  12. interface I(T:! type) {
  13. // TODO: Use `default` here.
  14. fn F[ref self: Self]() -> Self*;
  15. }
  16. // CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE+7]]:16: error: duplicate name `F` being declared in the same scope [NameDeclDuplicate]
  17. // CHECK:STDERR: fn I(T:! type).F[ref self: Self]() -> Self* { return &self; }
  18. // CHECK:STDERR: ^
  19. // CHECK:STDERR: fail_todo_generic_default_fn.carbon:[[@LINE-6]]:3: note: name is previously declared here [NameDeclPrevious]
  20. // CHECK:STDERR: fn F[ref self: Self]() -> Self*;
  21. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. // CHECK:STDERR:
  23. fn I(T:! type).F[ref self: Self]() -> Self* { return &self; }