fail_function_args.carbon 572 B

123456789101112131415161718192021
  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. fn f((var x: i32, y: i32)) -> i32 {
  10. x = 0;
  11. // CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/let/fail_function_args.carbon:[[@LINE+1]]: Cannot assign to rvalue 'y'
  12. y = 0;
  13. return x - 1;
  14. }
  15. fn Main() -> i32 {
  16. var t: auto = (1, 2);
  17. return f(t);
  18. }