e45bda3cd3778f2372ce18cc0d9ff7bbf1f50ba5 536 B

123456789101112131415161718192021222324252627282930
  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. // CHECK:STDOUT: result: 0
  7. package ExplorerTest;
  8. __mixin M1 {
  9. fn Scale10[self: Self](x:i32) -> i32{
  10. return x * 10;
  11. }
  12. }
  13. __mixin M2 {
  14. __mix M1;
  15. fn Square[self: Self](x:i32) -> i32{
  16. return x * x;
  17. }
  18. }
  19. class C {
  20. __mix M2;
  21. }
  22. fn Main() -> i32 {
  23. var c: C = {};
  24. return c.Square(11) - c.Scale10(10) - 21;
  25. }