param_unsupported.carbon 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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/interop/cpp/function/param_unsupported.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon
  12. // ============================================================================
  13. // Unsupported primitive type
  14. // ============================================================================
  15. // --- unsupported_primitive_type.h
  16. auto foo(_BitInt(23) a) -> void;
  17. // --- fail_todo_import_unsupported_primitive_type.carbon
  18. library "[[@TEST_NAME]]";
  19. import Cpp library "unsupported_primitive_type.h";
  20. fn F() {
  21. //@dump-sem-ir-begin
  22. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
  23. // CHECK:STDERR: Cpp.foo(11);
  24. // CHECK:STDERR: ^~~~~~~~~~~
  25. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
  26. // CHECK:STDERR: Cpp.foo(11);
  27. // CHECK:STDERR: ^~~~~~~~~~~
  28. // CHECK:STDERR:
  29. Cpp.foo(11);
  30. //@dump-sem-ir-end
  31. }
  32. // ============================================================================
  33. // Unsupported primitive type among params
  34. // ============================================================================
  35. // --- unsupported_primitive_type_among_params.h
  36. auto foo(int a, _BitInt(23) b) -> void;
  37. // --- fail_todo_import_unsupported_primitive_type_among_params.carbon
  38. library "[[@TEST_NAME]]";
  39. import Cpp library "unsupported_primitive_type_among_params.h";
  40. fn F() {
  41. //@dump-sem-ir-begin
  42. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
  43. // CHECK:STDERR: Cpp.foo(1, 20);
  44. // CHECK:STDERR: ^~~~~~~~~~~~~~
  45. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
  46. // CHECK:STDERR: Cpp.foo(1, 20);
  47. // CHECK:STDERR: ^~~~~~~~~~~~~~
  48. // CHECK:STDERR:
  49. Cpp.foo(1, 20);
  50. //@dump-sem-ir-end
  51. }
  52. // CHECK:STDOUT: --- fail_todo_import_unsupported_primitive_type.carbon
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: constants {
  55. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @<null name> [concrete]
  56. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  57. // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete]
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT:
  60. // CHECK:STDOUT: imports {
  61. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  62. // CHECK:STDOUT: .foo = %.a21
  63. // CHECK:STDOUT: import Cpp//...
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct]
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: fn @F() {
  69. // CHECK:STDOUT: !entry:
  70. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  71. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  72. // CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11]
  73. // CHECK:STDOUT: <elided>
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT:
  76. // CHECK:STDOUT: --- fail_todo_import_unsupported_primitive_type_among_params.carbon
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: constants {
  79. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @<null name> [concrete]
  80. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  81. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  82. // CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [concrete]
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: imports {
  86. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  87. // CHECK:STDOUT: .foo = %.a21
  88. // CHECK:STDOUT: import Cpp//...
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct]
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: fn @F() {
  94. // CHECK:STDOUT: !entry:
  95. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  96. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  97. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  98. // CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [concrete = constants.%int_20]
  99. // CHECK:STDOUT: <elided>
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: