fail_args_mismatch.carbon 811 B

1234567891011121314151617181920212223242526272829
  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. // RUN: %{not} %{explorer-run}
  7. // RUN: %{not} %{explorer-run-trace}
  8. package ExplorerTest api;
  9. class Point(T:! type) {
  10. // Point(T, T) does not match class declaration
  11. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_class/fail_args_mismatch.carbon:[[@LINE+1]]: wrong number of arguments in function call, expected 1 but got 2
  12. fn Origin(zero: T) -> Point(T, T) {
  13. return {.x = zero, .y = zero};
  14. }
  15. fn GetX[self: Point(T, T)]() -> T {
  16. return self.x;
  17. }
  18. var x: T;
  19. var y: T;
  20. }
  21. fn Main() -> i32 {
  22. var p: Point(i32) = Point(i32).Origin(0);
  23. return p.GetX();
  24. }