fail_method_member_name_clash.carbon 736 B

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. // NOAUTOUPDATE
  6. package ExplorerTest api;
  7. __mixin M {
  8. fn F[self: Self](x: Self) -> Self{
  9. return x;
  10. }
  11. }
  12. class C {
  13. fn F[self: Self](x: Self) -> Self {
  14. return x;
  15. }
  16. __mix M;
  17. // CHECK:STDERR: COMPILATION ERROR: fail_method_member_name_clash.carbon:[[@LINE+1]]: Member named F (declared at fail_method_member_name_clash.carbon:[[@LINE-8]]) cannot be mixed into C because it clashes with an existing member with the same name (declared at fail_method_member_name_clash.carbon:[[@LINE-2]])
  18. }
  19. fn Main() -> i32 {
  20. return 0;
  21. }