fail_impl_method_not_existing.carbon 602 B

12345678910111213141516171819202122
  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 api;
  7. base class C {
  8. }
  9. class D extends C {
  10. impl fn Foo[self:Self]() -> i32 {
  11. return 1;
  12. // CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_impl_method_not_existing.carbon:[[@LINE+1]]: Error declaring `Foo`: cannot override a method that is not declared `abstract` or `virtual` in base class.
  13. }
  14. }
  15. fn Main() -> i32 {
  16. let d: D = {};
  17. return 0;
  18. }