import.carbon 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/int.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/interop/cpp/import.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/import.carbon
  12. // --- header.h
  13. auto foo_short(short x) -> void;
  14. auto foo_int(int x) -> void;
  15. // --- api.carbon
  16. library "[[@TEST_NAME]]";
  17. import Cpp library "header.h";
  18. alias FooShort = Cpp.foo_short;
  19. alias FooInt = Cpp.foo_int;
  20. // --- import_api.carbon
  21. library "[[@TEST_NAME]]";
  22. import library "api";
  23. // TODO: Fix this test as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
  24. fn F() {
  25. //@dump-sem-ir-begin
  26. // FooShort(8 as i16);
  27. // FooInt(9);
  28. //@dump-sem-ir-end
  29. }
  30. // CHECK:STDOUT: --- import_api.carbon
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: constants {
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT:
  35. // CHECK:STDOUT: imports {
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn @F() {
  39. // CHECK:STDOUT: !entry:
  40. // CHECK:STDOUT: <elided>
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: