left_shift_assign.carbon 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. // EXTRA-ARGS: --no-dump-sem-ir
  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/int/left_shift_assign.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/left_shift_assign.carbon
  12. // --- call.carbon
  13. library "[[@TEST_NAME]]";
  14. fn Builtin(a: i32*, b: i32) = "int.left_shift_assign";
  15. fn Call(a: i32*, b: i32) {
  16. Builtin(a, b);
  17. }
  18. fn MixedTypes(a: i32*, b: i64) = "int.left_shift_assign";
  19. fn CallMixed(a: i32*, b: i64) {
  20. MixedTypes(a, b);
  21. }
  22. // --- fail_unsized.carbon
  23. library "[[@TEST_NAME]]";
  24. // CHECK:STDERR: fail_unsized.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature]
  25. // CHECK:STDERR: fn Builtin(a: Core.IntLiteral()*, b: Core.IntLiteral()) = "int.left_shift_assign";
  26. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. // CHECK:STDERR:
  28. fn Builtin(a: Core.IntLiteral()*, b: Core.IntLiteral()) = "int.left_shift_assign";
  29. // --- fail_bad_decl.carbon
  30. library "[[@TEST_NAME]]";
  31. // CHECK:STDERR: fail_bad_decl.carbon:[[@LINE+4]]:1: error: invalid signature for builtin function "int.left_shift_assign" [InvalidBuiltinSignature]
  32. // CHECK:STDERR: fn NotPtr(a: i32, b: i32) = "int.left_shift_assign";
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR:
  35. fn NotPtr(a: i32, b: i32) = "int.left_shift_assign";