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