fail_mix_members_clash.carbon 706 B

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