fail_error_recovery.carbon 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  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_error_recovery.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_error_recovery.carbon
  12. // --- fail_virtual_fn_in_invalid_context.carbon
  13. // CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+4]]:10: error: name `error_not_found` not found [NameNotFound]
  14. // CHECK:STDERR: fn F(N:! error_not_found) {
  15. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  16. // CHECK:STDERR:
  17. fn F(N:! error_not_found) {
  18. base class C {
  19. virtual fn Foo[self: Self]() {}
  20. }
  21. // CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE+7]]:3: error: redefinition of `impl Self as Core.Destroy` [ImplRedefinition]
  22. // CHECK:STDERR: base class D {
  23. // CHECK:STDERR: ^~~~~~~~~~~~~~
  24. // CHECK:STDERR: fail_virtual_fn_in_invalid_context.carbon:[[@LINE-7]]:3: note: previous definition was here [ImplPreviousDefinition]
  25. // CHECK:STDERR: base class C {
  26. // CHECK:STDERR: ^~~~~~~~~~~~~~
  27. // CHECK:STDERR:
  28. base class D {
  29. extend base: C;
  30. }
  31. }