fail_not_addable.carbon 775 B

12345678910111213141516171819202122
  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. // RUN: not executable_semantics %s 2>&1 | \
  6. // RUN: FileCheck --match-full-lines --allow-unused-prefixes=false %s
  7. // RUN: not executable_semantics --trace %s 2>&1 | \
  8. // RUN: FileCheck --match-full-lines --allow-unused-prefixes %s
  9. // AUTOUPDATE: executable_semantics %s
  10. // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_not_addable.carbon:17: type error in addition(1)
  11. // CHECK: expected: i32
  12. // CHECK: actual: T
  13. package ExecutableSemanticsTest api;
  14. fn id[T:! Type](x: T) -> T {
  15. return x + 0;
  16. }
  17. fn main() -> i32 {
  18. return id(0);
  19. }