| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- // Exceptions. See /LICENSE for license information.
- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- //
- // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon
- //
- // AUTOUPDATE
- // TIP: To test this file alone, run:
- // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/decayed_param.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/decayed_param.carbon
- // --- params.h
- void TakesArray(int arr[42]);
- void TakesFunction(int f(int));
- int Function(int);
- // --- call_params.carbon
- library "[[@TEST_NAME]]";
- import Cpp library "params.h";
- fn G(n: i32) -> i32;
- fn F() {
- //@dump-sem-ir-begin
- var n: array(i32, 42);
- Cpp.TakesArray(&n[0]);
- Cpp.TakesArray(Cpp.nullptr);
- //@dump-sem-ir-end
- }
- // --- fail_todo_call_params_2.carbon
- library "[[@TEST_NAME]]";
- import Cpp library "params.h";
- fn G(n: i32) -> i32;
- fn F() {
- //@dump-sem-ir-begin
- // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21: error: call argument of type `<type of G>` is not supported [CppCallArgTypeNotSupported]
- // CHECK:STDERR: Cpp.TakesFunction(G);
- // CHECK:STDERR: ^
- // CHECK:STDERR:
- Cpp.TakesFunction(G);
- // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21: error: call argument of type `<type of Cpp.Function>` is not supported [CppCallArgTypeNotSupported]
- // CHECK:STDERR: Cpp.TakesFunction(Cpp.Function);
- // CHECK:STDERR: ^~~~~~~~~~~~
- // CHECK:STDERR:
- Cpp.TakesFunction(Cpp.Function);
- var n: array(i32, 42);
- // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+8]]:26: error: no matching function for call to 'TakesFunction' [CppInteropParseError]
- // CHECK:STDERR: 31 | Cpp.TakesFunction(&n[0]);
- // CHECK:STDERR: | ^
- // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE-22]]:10: in file included here [InCppInclude]
- // CHECK:STDERR: ./params.h:3:6: note: candidate function not viable: no known conversion from 'int * _Nonnull' to 'int (*)(int)' for 1st argument [CppInteropParseNote]
- // CHECK:STDERR: 3 | void TakesFunction(int f(int));
- // CHECK:STDERR: | ^ ~~~~~~~~~~
- // CHECK:STDERR:
- Cpp.TakesFunction(&n[0]);
- // CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: int (*)(int)` [SemanticsTodo]
- // CHECK:STDERR: Cpp.TakesFunction(Cpp.nullptr);
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // CHECK:STDERR:
- Cpp.TakesFunction(Cpp.nullptr);
- //@dump-sem-ir-end
- }
- // CHECK:STDOUT: --- call_params.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
- // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete]
- // CHECK:STDOUT: %array_type: type = array_type %int_42, %i32 [concrete]
- // CHECK:STDOUT: %pattern_type.b6e: type = pattern_type %array_type [concrete]
- // CHECK:STDOUT: %TakesArray.cpp_overload_set.type: type = cpp_overload_set_type @TakesArray.cpp_overload_set [concrete]
- // CHECK:STDOUT: %TakesArray.cpp_overload_set.value: %TakesArray.cpp_overload_set.type = cpp_overload_set_value @TakesArray.cpp_overload_set [concrete]
- // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
- // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
- // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
- // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
- // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
- // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
- // CHECK:STDOUT: %ImplicitAs.facet.b94: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
- // CHECK:STDOUT: %.863: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet.b94 [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
- // CHECK:STDOUT: %bound_method.d2e: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
- // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
- // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
- // CHECK:STDOUT: %OptionalStorage.type: type = facet_type <@OptionalStorage> [concrete]
- // CHECK:STDOUT: %T.542: %OptionalStorage.type = symbolic_binding T, 0 [symbolic]
- // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
- // CHECK:STDOUT: %DestroyOp.type.3e79c2.2: type = fn_type @DestroyOp.2 [concrete]
- // CHECK:STDOUT: %DestroyOp.b0ebf8.2: %DestroyOp.type.3e79c2.2 = struct_value () [concrete]
- // CHECK:STDOUT: %ptr.e8f: type = ptr_type %T.67d [symbolic]
- // CHECK:STDOUT: %custom_witness.8095d9.2: <witness> = custom_witness (%DestroyOp.b0ebf8.2), @Destroy [concrete]
- // CHECK:STDOUT: %Destroy.facet.06f: %Destroy.type = facet_value %ptr.e8f, (%custom_witness.8095d9.2) [symbolic]
- // CHECK:STDOUT: %MaybeUnformed.40e: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.06f) [symbolic]
- // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.type.e4b: type = fn_type @ptr.as.OptionalStorage.impl.Some, @ptr.as.OptionalStorage.impl(%T.67d) [symbolic]
- // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.Some.d91: %ptr.as.OptionalStorage.impl.Some.type.e4b = struct_value () [symbolic]
- // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.None.type.f78: type = fn_type @ptr.as.OptionalStorage.impl.None, @ptr.as.OptionalStorage.impl(%T.67d) [symbolic]
- // CHECK:STDOUT: %ptr.as.OptionalStorage.impl.None.d08: %ptr.as.OptionalStorage.impl.None.type.f78 = struct_value () [symbolic]
- // CHECK:STDOUT: %OptionalStorage.impl_witness.efb: <witness> = impl_witness imports.%OptionalStorage.impl_witness_table.70a, @ptr.as.OptionalStorage.impl(%i32) [concrete]
- // CHECK:STDOUT: %OptionalStorage.facet.e81: %OptionalStorage.type = facet_value %ptr.235, (%OptionalStorage.impl_witness.efb) [concrete]
- // CHECK:STDOUT: %Optional.f08: type = class_type @Optional, @Optional(%OptionalStorage.facet.e81) [concrete]
- // CHECK:STDOUT: %TakesArray.type: type = fn_type @TakesArray [concrete]
- // CHECK:STDOUT: %TakesArray: %TakesArray.type = struct_value () [concrete]
- // CHECK:STDOUT: %ImplicitAs.type.9cf: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.f08)> [concrete]
- // CHECK:STDOUT: %ImplicitAs.Convert.type.c7a: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Optional.f08) [concrete]
- // CHECK:STDOUT: %OptionalAs.type.ea5: type = facet_type <@OptionalAs, @OptionalAs(%T.542)> [symbolic]
- // CHECK:STDOUT: %U.2d2: %OptionalAs.type.ea5 = symbolic_binding U, 1 [symbolic]
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.4c5: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.71c(%T.542, %U.2d2) [symbolic]
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.cb0: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.4c5 = struct_value () [symbolic]
- // CHECK:STDOUT: %OptionalAs.type.12a: type = facet_type <@OptionalAs, @OptionalAs(%OptionalStorage.facet.e81)> [concrete]
- // CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.type.d22: type = fn_type @T.binding.as_type.as.OptionalAs.impl.Convert, @T.binding.as_type.as.OptionalAs.impl(%T.542) [symbolic]
- // CHECK:STDOUT: %T.binding.as_type.as.OptionalAs.impl.Convert.d8f: %T.binding.as_type.as.OptionalAs.impl.Convert.type.d22 = struct_value () [symbolic]
- // CHECK:STDOUT: %OptionalAs.impl_witness.d83: <witness> = impl_witness imports.%OptionalAs.impl_witness_table.cea, @T.binding.as_type.as.OptionalAs.impl(%OptionalStorage.facet.e81) [concrete]
- // CHECK:STDOUT: %OptionalAs.facet: %OptionalAs.type.12a = facet_value %ptr.235, (%OptionalAs.impl_witness.d83) [concrete]
- // CHECK:STDOUT: %ImplicitAs.impl_witness.862: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.840, @U.binding.as_type.as.ImplicitAs.impl.71c(%OptionalStorage.facet.e81, %OptionalAs.facet) [concrete]
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.ed2: type = fn_type @U.binding.as_type.as.ImplicitAs.impl.Convert.2, @U.binding.as_type.as.ImplicitAs.impl.71c(%OptionalStorage.facet.e81, %OptionalAs.facet) [concrete]
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.93d: %U.binding.as_type.as.ImplicitAs.impl.Convert.type.ed2 = struct_value () [concrete]
- // CHECK:STDOUT: %ImplicitAs.facet.642: %ImplicitAs.type.9cf = facet_value %ptr.235, (%ImplicitAs.impl_witness.862) [concrete]
- // CHECK:STDOUT: %.587: type = fn_type_with_self_type %ImplicitAs.Convert.type.c7a, %ImplicitAs.facet.642 [concrete]
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %U.binding.as_type.as.ImplicitAs.impl.Convert.93d, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.e81, %OptionalAs.facet) [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t: type = class_type @NullptrT [concrete]
- // CHECK:STDOUT: %uninit: %Cpp.nullptr_t = uninitialized_value [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type.c8e: type = fn_type @Cpp.nullptr_t.as.ImplicitAs.impl.Convert, @Cpp.nullptr_t.as.ImplicitAs.impl(%T.67d) [symbolic]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.b87: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type.c8e = struct_value () [symbolic]
- // CHECK:STDOUT: %ImplicitAs.impl_witness.004: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.cd4, @Cpp.nullptr_t.as.ImplicitAs.impl(%i32) [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type.f06: type = fn_type @Cpp.nullptr_t.as.ImplicitAs.impl.Convert, @Cpp.nullptr_t.as.ImplicitAs.impl(%i32) [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.2fd: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type.f06 = struct_value () [concrete]
- // CHECK:STDOUT: %ImplicitAs.facet.2af: %ImplicitAs.type.9cf = facet_value %Cpp.nullptr_t, (%ImplicitAs.impl_witness.004) [concrete]
- // CHECK:STDOUT: %.aef: type = fn_type_with_self_type %ImplicitAs.Convert.type.c7a, %ImplicitAs.facet.2af [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %uninit, %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.2fd [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.2fd, @Cpp.nullptr_t.as.ImplicitAs.impl.Convert(%i32) [concrete]
- // CHECK:STDOUT: %bound_method.3f0: <bound method> = bound_method %uninit, %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.specific_fn [concrete]
- // CHECK:STDOUT: %DestroyOp.type.3e79c2.7: type = fn_type @DestroyOp.loc13 [concrete]
- // CHECK:STDOUT: %DestroyOp.b0ebf8.7: %DestroyOp.type.3e79c2.7 = struct_value () [concrete]
- // CHECK:STDOUT: %DestroyOp.type.3e79c2.8: type = fn_type @DestroyOp.loc10 [concrete]
- // CHECK:STDOUT: %DestroyOp.b0ebf8.8: %DestroyOp.type.3e79c2.8 = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
- // CHECK:STDOUT: .TakesArray = %TakesArray.cpp_overload_set.value
- // CHECK:STDOUT: .nullptr = @F.%uninit
- // CHECK:STDOUT: import Cpp//...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %TakesArray.cpp_overload_set.value: %TakesArray.cpp_overload_set.type = cpp_overload_set_value @TakesArray.cpp_overload_set [concrete = constants.%TakesArray.cpp_overload_set.value]
- // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
- // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
- // CHECK:STDOUT: %Core.import_ref.75b: type = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%MaybeUnformed (constants.%MaybeUnformed.40e)]
- // CHECK:STDOUT: %Core.import_ref.e3f: @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.None.type (%ptr.as.OptionalStorage.impl.None.type.f78) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.None (constants.%ptr.as.OptionalStorage.impl.None.d08)]
- // CHECK:STDOUT: %Core.import_ref.66a: @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some.type (%ptr.as.OptionalStorage.impl.Some.type.e4b) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some (constants.%ptr.as.OptionalStorage.impl.Some.d91)]
- // CHECK:STDOUT: %Core.import_ref.23a = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
- // CHECK:STDOUT: %Core.import_ref.afb = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
- // CHECK:STDOUT: %OptionalStorage.impl_witness_table.70a = impl_witness_table (%Core.import_ref.75b, %Core.import_ref.e3f, %Core.import_ref.66a, %Core.import_ref.23a, %Core.import_ref.afb), @ptr.as.OptionalStorage.impl [concrete]
- // CHECK:STDOUT: %TakesArray.decl: %TakesArray.type = fn_decl @TakesArray [concrete = constants.%TakesArray] {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: } {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %.loc11_23.1: type = splice_block %Optional [concrete = constants.%Optional.f08] {
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.235, (constants.%OptionalStorage.impl_witness.efb) [concrete = constants.%OptionalStorage.facet.e81]
- // CHECK:STDOUT: %.loc11_23.2: %OptionalStorage.type = converted constants.%ptr.235, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.e81]
- // CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.e81) [concrete = constants.%Optional.f08]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %Core.import_ref.059: @U.binding.as_type.as.ImplicitAs.impl.71c.%U.binding.as_type.as.ImplicitAs.impl.Convert.type (%U.binding.as_type.as.ImplicitAs.impl.Convert.type.4c5) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @U.binding.as_type.as.ImplicitAs.impl.71c.%U.binding.as_type.as.ImplicitAs.impl.Convert (constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.cb0)]
- // CHECK:STDOUT: %ImplicitAs.impl_witness_table.840 = impl_witness_table (%Core.import_ref.059), @U.binding.as_type.as.ImplicitAs.impl.71c [concrete]
- // CHECK:STDOUT: %Core.import_ref.6fb: @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert.type (%T.binding.as_type.as.OptionalAs.impl.Convert.type.d22) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @T.binding.as_type.as.OptionalAs.impl.%T.binding.as_type.as.OptionalAs.impl.Convert (constants.%T.binding.as_type.as.OptionalAs.impl.Convert.d8f)]
- // CHECK:STDOUT: %OptionalAs.impl_witness_table.cea = impl_witness_table (%Core.import_ref.6fb), @T.binding.as_type.as.OptionalAs.impl [concrete]
- // CHECK:STDOUT: %Core.import_ref.a0e: @Cpp.nullptr_t.as.ImplicitAs.impl.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type (%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.type.c8e) = import_ref Core//prelude/types/cpp/nullptr, loc{{\d+_\d+}}, loaded [symbolic = @Cpp.nullptr_t.as.ImplicitAs.impl.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert (constants.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.b87)]
- // CHECK:STDOUT: %ImplicitAs.impl_witness_table.cd4 = impl_witness_table (%Core.import_ref.a0e), @Cpp.nullptr_t.as.ImplicitAs.impl [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %n.patt: %pattern_type.b6e = ref_binding_pattern n [concrete]
- // CHECK:STDOUT: %n.var_patt: %pattern_type.b6e = var_pattern %n.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %n.var: ref %array_type = var %n.var_patt
- // CHECK:STDOUT: %.loc10: type = splice_block %array_type [concrete = constants.%array_type] {
- // CHECK:STDOUT: %int_32.loc10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32.loc10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
- // CHECK:STDOUT: %array_type: type = array_type %int_42, %i32.loc10 [concrete = constants.%array_type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %n: ref %array_type = ref_binding n, %n.var
- // CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesArray.ref.loc11: %TakesArray.cpp_overload_set.type = name_ref TakesArray, imports.%TakesArray.cpp_overload_set.value [concrete = constants.%TakesArray.cpp_overload_set.value]
- // CHECK:STDOUT: %n.ref: ref %array_type = name_ref n, %n
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
- // CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: %impl.elem0.loc11_21: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
- // CHECK:STDOUT: %bound_method.loc11_21.1: <bound method> = bound_method %int_0, %impl.elem0.loc11_21 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
- // CHECK:STDOUT: %specific_fn.loc11_21: <specific function> = specific_function %impl.elem0.loc11_21, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
- // CHECK:STDOUT: %bound_method.loc11_21.2: <bound method> = bound_method %int_0, %specific_fn.loc11_21 [concrete = constants.%bound_method.d2e]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc11_21.2(%int_0) [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc11_21.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc11_21.2: %i32 = converted %int_0, %.loc11_21.1 [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc11_22: ref %i32 = array_index %n.ref, %.loc11_21.2
- // CHECK:STDOUT: %addr: %ptr.235 = addr_of %.loc11_22
- // CHECK:STDOUT: %impl.elem0.loc11_18: %.587 = impl_witness_access constants.%ImplicitAs.impl_witness.862, element0 [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.93d]
- // CHECK:STDOUT: %bound_method.loc11_18.1: <bound method> = bound_method %addr, %impl.elem0.loc11_18
- // CHECK:STDOUT: %specific_fn.loc11_18: <specific function> = specific_function %impl.elem0.loc11_18, @U.binding.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.e81, constants.%OptionalAs.facet) [concrete = constants.%U.binding.as_type.as.ImplicitAs.impl.Convert.specific_fn]
- // CHECK:STDOUT: %bound_method.loc11_18.2: <bound method> = bound_method %addr, %specific_fn.loc11_18
- // CHECK:STDOUT: %U.binding.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.f08 = call %bound_method.loc11_18.2(%addr)
- // CHECK:STDOUT: %.loc11_18.1: init %Optional.f08 = converted %addr, %U.binding.as_type.as.ImplicitAs.impl.Convert.call
- // CHECK:STDOUT: %.loc11_18.2: ref %Optional.f08 = temporary_storage
- // CHECK:STDOUT: %.loc11_18.3: ref %Optional.f08 = temporary %.loc11_18.2, %.loc11_18.1
- // CHECK:STDOUT: %.loc11_18.4: %Optional.f08 = acquire_value %.loc11_18.3
- // CHECK:STDOUT: %TakesArray.call.loc11: init %empty_tuple.type = call imports.%TakesArray.decl(%.loc11_18.4)
- // CHECK:STDOUT: %Cpp.ref.loc13_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesArray.ref.loc13: %TakesArray.cpp_overload_set.type = name_ref TakesArray, imports.%TakesArray.cpp_overload_set.value [concrete = constants.%TakesArray.cpp_overload_set.value]
- // CHECK:STDOUT: %Cpp.ref.loc13_18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit]
- // CHECK:STDOUT: %impl.elem0.loc13: %.aef = impl_witness_access constants.%ImplicitAs.impl_witness.004, element0 [concrete = constants.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.2fd]
- // CHECK:STDOUT: %bound_method.loc13_21.1: <bound method> = bound_method %nullptr.ref, %impl.elem0.loc13 [concrete = constants.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.bound]
- // CHECK:STDOUT: %specific_fn.loc13: <specific function> = specific_function %impl.elem0.loc13, @Cpp.nullptr_t.as.ImplicitAs.impl.Convert(constants.%i32) [concrete = constants.%Cpp.nullptr_t.as.ImplicitAs.impl.Convert.specific_fn]
- // CHECK:STDOUT: %bound_method.loc13_21.2: <bound method> = bound_method %nullptr.ref, %specific_fn.loc13 [concrete = constants.%bound_method.3f0]
- // CHECK:STDOUT: %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call: init %Optional.f08 = call %bound_method.loc13_21.2(%nullptr.ref)
- // CHECK:STDOUT: %.loc13_21.1: init %Optional.f08 = converted %nullptr.ref, %Cpp.nullptr_t.as.ImplicitAs.impl.Convert.call
- // CHECK:STDOUT: %.loc13_21.2: ref %Optional.f08 = temporary_storage
- // CHECK:STDOUT: %.loc13_21.3: ref %Optional.f08 = temporary %.loc13_21.2, %.loc13_21.1
- // CHECK:STDOUT: %.loc13_21.4: %Optional.f08 = acquire_value %.loc13_21.3
- // CHECK:STDOUT: %TakesArray.call.loc13: init %empty_tuple.type = call imports.%TakesArray.decl(%.loc13_21.4)
- // CHECK:STDOUT: %DestroyOp.bound.loc13: <bound method> = bound_method %.loc13_21.3, constants.%DestroyOp.b0ebf8.7
- // CHECK:STDOUT: %DestroyOp.call.loc13: init %empty_tuple.type = call %DestroyOp.bound.loc13(%.loc13_21.3)
- // CHECK:STDOUT: %DestroyOp.bound.loc11: <bound method> = bound_method %.loc11_18.3, constants.%DestroyOp.b0ebf8.7
- // CHECK:STDOUT: %DestroyOp.call.loc11: init %empty_tuple.type = call %DestroyOp.bound.loc11(%.loc11_18.3)
- // CHECK:STDOUT: %DestroyOp.bound.loc10: <bound method> = bound_method %n.var, constants.%DestroyOp.b0ebf8.8
- // CHECK:STDOUT: %DestroyOp.call.loc10: init %empty_tuple.type = call %DestroyOp.bound.loc10(%n.var)
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @DestroyOp.loc13(%self.param: %Optional.f08) = "no_op";
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @DestroyOp.loc10(%self.param: %array_type) = "no_op";
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_todo_call_params_2.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
- // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
- // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
- // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
- // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
- // CHECK:STDOUT: %TakesFunction.cpp_overload_set.type: type = cpp_overload_set_type @TakesFunction.cpp_overload_set [concrete]
- // CHECK:STDOUT: %TakesFunction.cpp_overload_set.value: %TakesFunction.cpp_overload_set.type = cpp_overload_set_value @TakesFunction.cpp_overload_set [concrete]
- // CHECK:STDOUT: %Function.cpp_overload_set.type: type = cpp_overload_set_type @Function.cpp_overload_set [concrete]
- // CHECK:STDOUT: %Function.cpp_overload_set.value: %Function.cpp_overload_set.type = cpp_overload_set_value @Function.cpp_overload_set [concrete]
- // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete]
- // CHECK:STDOUT: %array_type: type = array_type %int_42, %i32 [concrete]
- // CHECK:STDOUT: %pattern_type.b6e: type = pattern_type %array_type [concrete]
- // CHECK:STDOUT: %int_0.5c6: Core.IntLiteral = int_value 0 [concrete]
- // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
- // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
- // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
- // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
- // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
- // CHECK:STDOUT: %.863: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
- // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_0.5c6, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
- // CHECK:STDOUT: %int_0.6a9: %i32 = int_value 0 [concrete]
- // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
- // CHECK:STDOUT: %Cpp.nullptr_t: type = class_type @NullptrT [concrete]
- // CHECK:STDOUT: %uninit: %Cpp.nullptr_t = uninitialized_value [concrete]
- // CHECK:STDOUT: %DestroyOp.type.3e79c2.2: type = fn_type @DestroyOp.loc22 [concrete]
- // CHECK:STDOUT: %DestroyOp.b0ebf8.2: %DestroyOp.type.3e79c2.2 = struct_value () [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
- // CHECK:STDOUT: .TakesFunction = %TakesFunction.cpp_overload_set.value
- // CHECK:STDOUT: .Function = %Function.cpp_overload_set.value
- // CHECK:STDOUT: .nullptr = @F.%uninit
- // CHECK:STDOUT: import Cpp//...
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %TakesFunction.cpp_overload_set.value: %TakesFunction.cpp_overload_set.type = cpp_overload_set_value @TakesFunction.cpp_overload_set [concrete = constants.%TakesFunction.cpp_overload_set.value]
- // CHECK:STDOUT: %Function.cpp_overload_set.value: %Function.cpp_overload_set.type = cpp_overload_set_value @Function.cpp_overload_set [concrete = constants.%Function.cpp_overload_set.value]
- // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
- // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @F() {
- // CHECK:STDOUT: !entry:
- // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesFunction.ref.loc14: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
- // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G]
- // CHECK:STDOUT: %Cpp.ref.loc20_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesFunction.ref.loc20: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
- // CHECK:STDOUT: %Cpp.ref.loc20_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %Function.ref: %Function.cpp_overload_set.type = name_ref Function, imports.%Function.cpp_overload_set.value [concrete = constants.%Function.cpp_overload_set.value]
- // CHECK:STDOUT: name_binding_decl {
- // CHECK:STDOUT: %n.patt: %pattern_type.b6e = ref_binding_pattern n [concrete]
- // CHECK:STDOUT: %n.var_patt: %pattern_type.b6e = var_pattern %n.patt [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %n.var: ref %array_type = var %n.var_patt
- // CHECK:STDOUT: %.loc22: type = splice_block %array_type [concrete = constants.%array_type] {
- // CHECK:STDOUT: %int_32.loc22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32.loc22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
- // CHECK:STDOUT: %array_type: type = array_type %int_42, %i32.loc22 [concrete = constants.%array_type]
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %n: ref %array_type = ref_binding n, %n.var
- // CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesFunction.ref.loc31: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
- // CHECK:STDOUT: %n.ref: ref %array_type = name_ref n, %n
- // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
- // CHECK:STDOUT: %int_32.loc31: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
- // CHECK:STDOUT: %i32.loc31: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
- // CHECK:STDOUT: %impl.elem0: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
- // CHECK:STDOUT: %bound_method.loc31_24.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
- // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
- // CHECK:STDOUT: %bound_method.loc31_24.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
- // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc31_24.2(%int_0) [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc31_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc31_24.2: %i32 = converted %int_0, %.loc31_24.1 [concrete = constants.%int_0.6a9]
- // CHECK:STDOUT: %.loc31_25: ref %i32 = array_index %n.ref, %.loc31_24.2
- // CHECK:STDOUT: %addr: %ptr.235 = addr_of %.loc31_25
- // CHECK:STDOUT: %Cpp.ref.loc37_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: %TakesFunction.ref.loc37: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
- // CHECK:STDOUT: %Cpp.ref.loc37_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit]
- // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %n.var, constants.%DestroyOp.b0ebf8.2
- // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%n.var)
- // CHECK:STDOUT: <elided>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: fn @DestroyOp.loc22(%self.param: %array_type) = "no_op";
- // CHECK:STDOUT:
|