div_assign.carbon 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/div_assign.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/div_assign.carbon
  12. // --- call.carbon
  13. library "[[@TEST_NAME]]";
  14. fn Builtin(ref a: f64, b: f64) = "float.div_assign";
  15. fn Call(ref a: f64, b: f64) {
  16. Builtin(ref a, b);
  17. }
  18. // --- fail_bad_decl.carbon
  19. library "[[@TEST_NAME]]";
  20. // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
  21. // CHECK:STDERR: fn NotRef(a: f64, b: f64) = "float.div_assign";
  22. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  23. // CHECK:STDERR:
  24. fn NotRef(a: f64, b: f64) = "float.div_assign";
  25. // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
  26. // CHECK:STDERR: fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
  27. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  28. // CHECK:STDERR:
  29. fn MixedTypes(ref a: f64, b: f32) = "float.div_assign";
  30. // --- fail_literal.carbon
  31. library "[[@TEST_NAME]]";
  32. fn Literal() -> type = "float_literal.make_type";
  33. // CHECK:STDERR: fail_literal.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "float.div_assign" [InvalidBuiltinSignature]
  34. // CHECK:STDERR: fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";
  35. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  36. // CHECK:STDERR:
  37. fn LiteralRuntime(ref a: Literal(), b: Literal()) = "float.div_assign";