mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 19:31:08 +01:00
Support pass-by-move when calling a C++ function taking by value. (#7135)
Previously, we picked a single Carbon parameter pattern for each C++ parameter pattern. This doesn't work well in cases where the Carbon semantics and the C++ semantics are not perfectly aligned. In particular, when a parameter is passed by value in C++, that might mean either pass-by-move (which in Carbon would best be modeled by a `var` pattern, as no other form of parameter would perform a move) or pass-by-copy (which in Carbon would best be modeled by a value parameter, as a `var` parameter would force an extra copy). After this change, we compute a passing mode for each parameter based on the implicit conversion sequence from the argument to the parameter as determined by C++ overload resolution, and use that to determine the Carbon pattern corresponding to each C++ parameter. This results in potentially generating multiple different thunks for the same C++ function if it's called in different ways, but we already did that to handle default arguments and list-initialization. The passing modes are included in the thunk mangling. Add a new value store for clang decl signatures, which capture the information about parameter passing mode as well as the other existing information about different ways that a C++ function might be imported to Carbon. Most of the rules for computing passing modes are the same as before: const references use pass by value, non-const lvalue references use pass-by-ref, non-const rvalue references use pass-by-var. But for C++ non-reference parameters, pick between pass-by-value and pass-by-var based on whether the implicit conversion sequence was effectively performing a copy. Prefer pass-by-value if either would work and they'd do the same thing. We still use pass-by-value for const references, even when the argument is an lvalue and we could pass a reference; we may want to change this in future. For virtual functions, we try to pick a worst-case passing mode, as we can only pick a single signature for what goes in the vtable. Calls to virtual functions will still use a thunk to C++, allowing variance in the calling convention at call sites. We don't allow variance in the overriders as we don't implement support for thunks for virtual functions yet. We currently use pass-by-value for const reference parameters here, but that should probably change at some point. Assisted-by: Gemini via Antigravity
This commit is contained in:
@@ -201,7 +201,8 @@ fn UseZ() -> Cpp.A.Z {
|
||||
// CHECK:STDOUT: %.loc15_12.2: ref %X = temporary %.loc15_12.1, %F.call
|
||||
// CHECK:STDOUT: %g.ref: %X.g.cpp_overload_set.type = name_ref g, imports.%X.g.cpp_overload_set.value [concrete = constants.%X.g.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc15_12.2, %g.ref
|
||||
// CHECK:STDOUT: %X.g.call: init %i32 = call imports.%X.g.decl(%.loc15_12.2)
|
||||
// CHECK:STDOUT: %.loc15_12.3: %X = acquire_value %.loc15_12.2
|
||||
// CHECK:STDOUT: %X.g.call: init %i32 = call imports.%X.g.decl(%.loc15_12.3)
|
||||
// CHECK:STDOUT: %X.cpp_destructor.bound: <bound method> = bound_method %.loc15_12.2, constants.%X.cpp_destructor
|
||||
// CHECK:STDOUT: %X.cpp_destructor.call: init %empty_tuple.type = call %X.cpp_destructor.bound(%.loc15_12.2)
|
||||
// CHECK:STDOUT: return %X.g.call
|
||||
|
||||
+24
-16
@@ -288,12 +288,14 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %const_ref_ref_this__carbon_thunk: %const_ref_ref_this__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.cpp_overload_set.type: type = cpp_overload_set_type @HasQualifiers.plain.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.cpp_overload_set.value: %HasQualifiers.plain.cpp_overload_set.type = cpp_overload_set_value @HasQualifiers.plain.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.type: type = fn_type @HasQualifiers.plain [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain: %HasQualifiers.plain.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.type.b9c87a.1: type = fn_type @HasQualifiers.plain.1 [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.4829ab.1: %HasQualifiers.plain.type.b9c87a.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.cpp_overload_set.type: type = cpp_overload_set_type @HasQualifiers.ref_this.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.cpp_overload_set.value: %HasQualifiers.ref_this.cpp_overload_set.type = cpp_overload_set_value @HasQualifiers.ref_this.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.type: type = fn_type @HasQualifiers.ref_this [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this: %HasQualifiers.ref_this.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.type.b9c87a.2: type = fn_type @HasQualifiers.plain.2 [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.4829ab.2: %HasQualifiers.plain.type.b9c87a.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_ref_this.cpp_overload_set.type: type = cpp_overload_set_type @HasQualifiers.ref_ref_this.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_ref_this.cpp_overload_set.value: %HasQualifiers.ref_ref_this.cpp_overload_set.type = cpp_overload_set_value @HasQualifiers.ref_ref_this.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ref_ref_this__carbon_thunk.type: type = fn_type @ref_ref_this__carbon_thunk [concrete]
|
||||
@@ -337,7 +339,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.cpp_overload_set.value: %HasQualifiers.plain.cpp_overload_set.type = cpp_overload_set_value @HasQualifiers.plain.cpp_overload_set [concrete = constants.%HasQualifiers.plain.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.decl: %HasQualifiers.plain.type = fn_decl @HasQualifiers.plain [concrete = constants.%HasQualifiers.plain] {
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.decl.020d0d.1: %HasQualifiers.plain.type.b9c87a.1 = fn_decl @HasQualifiers.plain.1 [concrete = constants.%HasQualifiers.plain.4829ab.1] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -348,6 +350,11 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.decl.020d0d.2: %HasQualifiers.plain.type.b9c87a.2 = fn_decl @HasQualifiers.plain.2 [concrete = constants.%HasQualifiers.plain.4829ab.2] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_ref_this.cpp_overload_set.value: %HasQualifiers.ref_ref_this.cpp_overload_set.type = cpp_overload_set_value @HasQualifiers.ref_ref_this.cpp_overload_set [concrete = constants.%HasQualifiers.ref_ref_this.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ref_ref_this__carbon_thunk.decl: %ref_ref_this__carbon_thunk.type = fn_decl @ref_ref_this__carbon_thunk [concrete = constants.%ref_ref_this__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -389,7 +396,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %.loc14: ref %HasQualifiers = deref %p.ref.loc14
|
||||
// CHECK:STDOUT: %plain.ref.loc14: %HasQualifiers.plain.cpp_overload_set.type = name_ref plain, imports.%HasQualifiers.plain.cpp_overload_set.value [concrete = constants.%HasQualifiers.plain.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %.loc14, %plain.ref.loc14
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call.loc14: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl(%.loc14)
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call.loc14: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl.020d0d.1(%.loc14)
|
||||
// CHECK:STDOUT: %p.ref.loc15: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc15: ref %HasQualifiers = deref %p.ref.loc15
|
||||
// CHECK:STDOUT: %ref_this.ref: %HasQualifiers.ref_this.cpp_overload_set.type = name_ref ref_this, imports.%HasQualifiers.ref_this.cpp_overload_set.value [concrete = constants.%HasQualifiers.ref_this.cpp_overload_set.value]
|
||||
@@ -413,7 +420,8 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %.loc19_8.2: ref %HasQualifiers = temporary %.loc19_8.1, %Make.call.loc19
|
||||
// CHECK:STDOUT: %plain.ref.loc19: %HasQualifiers.plain.cpp_overload_set.type = name_ref plain, imports.%HasQualifiers.plain.cpp_overload_set.value [concrete = constants.%HasQualifiers.plain.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc19: <bound method> = bound_method %.loc19_8.2, %plain.ref.loc19
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call.loc19: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl(%.loc19_8.2)
|
||||
// CHECK:STDOUT: %.loc19_8.3: %HasQualifiers = acquire_value %.loc19_8.2
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call.loc19: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl.020d0d.2(%.loc19_8.3)
|
||||
// CHECK:STDOUT: %Make.ref.loc20: %Make.type = name_ref Make, file.%Make.decl [concrete = constants.%Make]
|
||||
// CHECK:STDOUT: %.loc20_8.1: ref %HasQualifiers = temporary_storage
|
||||
// CHECK:STDOUT: %Make.call.loc20: init %HasQualifiers to %.loc20_8.1 = call %Make.ref.loc20()
|
||||
@@ -640,8 +648,8 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %F__carbon_thunk: %F__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.cpp_overload_set.type: type = cpp_overload_set_type @ExplicitObjectParam.G.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.cpp_overload_set.value: %ExplicitObjectParam.G.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParam.G.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.type: type = fn_type @ExplicitObjectParam.G [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G: %ExplicitObjectParam.G.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %G__carbon_thunk.type: type = fn_type @G__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %G__carbon_thunk: %G__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H.cpp_overload_set.type: type = cpp_overload_set_type @ExplicitObjectParam.H.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H.cpp_overload_set.value: %ExplicitObjectParam.H.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParam.H.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ptr.289: type = ptr_type %Another [concrete]
|
||||
@@ -664,7 +672,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.cpp_overload_set.value: %ExplicitObjectParam.G.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParam.G.cpp_overload_set [concrete = constants.%ExplicitObjectParam.G.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.decl: %ExplicitObjectParam.G.type = fn_decl @ExplicitObjectParam.G [concrete = constants.%ExplicitObjectParam.G] {
|
||||
// CHECK:STDOUT: %G__carbon_thunk.decl: %G__carbon_thunk.type = fn_decl @G__carbon_thunk [concrete = constants.%G__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -690,7 +698,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc9: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
// CHECK:STDOUT: %G.ref: %ExplicitObjectParam.G.cpp_overload_set.type = name_ref G, imports.%ExplicitObjectParam.G.cpp_overload_set.value [concrete = constants.%ExplicitObjectParam.G.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %n.ref, %G.ref
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.call: init %empty_tuple.type = call imports.%ExplicitObjectParam.G.decl(%n.ref)
|
||||
// CHECK:STDOUT: %G__carbon_thunk.call: init %empty_tuple.type = call imports.%G__carbon_thunk.decl(%n.ref)
|
||||
// CHECK:STDOUT: %a.ref: %Another = name_ref a, %a
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc10: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
@@ -715,11 +723,11 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %ptr.7f5: type = ptr_type %ExplicitObjectParam [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.eda1ac.1: type = fn_type @F__carbon_thunk.1 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.0cd6a8.1: %F__carbon_thunk.type.eda1ac.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.type.5d25a8.2: type = fn_type @ExplicitObjectParam.F.2 [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.28cf2e.2: %ExplicitObjectParam.F.type.5d25a8.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.289: type = ptr_type %Another [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.eda1ac.2: type = fn_type @F__carbon_thunk.2 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.0cd6a8.2: %F__carbon_thunk.type.eda1ac.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.289: type = ptr_type %Another [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.eda1ac.3: type = fn_type @F__carbon_thunk.3 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.0cd6a8.3: %F__carbon_thunk.type.eda1ac.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -736,12 +744,12 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.decl.28f5af.2: %ExplicitObjectParam.F.type.5d25a8.2 = fn_decl @ExplicitObjectParam.F.2 [concrete = constants.%ExplicitObjectParam.F.28cf2e.2] {
|
||||
// CHECK:STDOUT: %F__carbon_thunk.decl.e1b8ec.2: %F__carbon_thunk.type.eda1ac.2 = fn_decl @F__carbon_thunk.2 [concrete = constants.%F__carbon_thunk.0cd6a8.2] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %F__carbon_thunk.decl.e1b8ec.2: %F__carbon_thunk.type.eda1ac.2 = fn_decl @F__carbon_thunk.2 [concrete = constants.%F__carbon_thunk.0cd6a8.2] {
|
||||
// CHECK:STDOUT: %F__carbon_thunk.decl.e1b8ec.3: %F__carbon_thunk.type.eda1ac.3 = fn_decl @F__carbon_thunk.3 [concrete = constants.%F__carbon_thunk.0cd6a8.3] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -761,7 +769,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc9: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
// CHECK:STDOUT: %F.ref.loc9: %ExplicitObjectParam.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParam.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParam.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %n.ref, %F.ref.loc9
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.call: init %empty_tuple.type = call imports.%ExplicitObjectParam.F.decl.28f5af.2(%n.ref)
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.2(%n.ref)
|
||||
// CHECK:STDOUT: %a.ref: %Another = name_ref a, %a
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc10: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
@@ -769,7 +777,7 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %a.ref, %F.ref.loc10
|
||||
// CHECK:STDOUT: %.loc10: ref %Another = value_as_ref %a.ref
|
||||
// CHECK:STDOUT: %addr.loc10: %ptr.289 = addr_of %.loc10
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc10: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.2(%addr.loc10)
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc10: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.3(%addr.loc10)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -119,7 +119,8 @@ fn G() {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc10_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %e.ref: %.bb7 = name_ref e, imports.%int_1.1d6 [concrete = constants.%int_1.1d6]
|
||||
// CHECK:STDOUT: %C.F.call: init %empty_tuple.type = call imports.%C.F.decl(%.loc10_11.3, %e.ref)
|
||||
// CHECK:STDOUT: %.loc10_11.4: %C = acquire_value %.loc10_11.3
|
||||
// CHECK:STDOUT: %C.F.call: init %empty_tuple.type = call imports.%C.F.decl(%.loc10_11.4, %e.ref)
|
||||
// CHECK:STDOUT: %C.cpp_destructor.bound: <bound method> = bound_method %.loc10_11.3, constants.%C.cpp_destructor
|
||||
// CHECK:STDOUT: %C.cpp_destructor.call: init %empty_tuple.type = call %C.cpp_destructor.bound(%.loc10_11.3)
|
||||
// CHECK:STDOUT: return
|
||||
|
||||
@@ -142,6 +142,110 @@ fn F(c: Cpp.C) {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Move-only class as parameter type
|
||||
// ============================================================================
|
||||
|
||||
// --- move_only_param_type.h
|
||||
|
||||
struct C {
|
||||
C(C&&);
|
||||
};
|
||||
|
||||
auto foo(C) -> void;
|
||||
auto make() -> C;
|
||||
auto move(C&) -> C&&;
|
||||
|
||||
// --- pass_move_only_param_temporary.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "move_only_param_type.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo(Cpp.make());
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- fail_pass_move_only_param_value.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'C' [CppInteropParseError]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^~~
|
||||
// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'C' has a user-declared move constructor [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | C(C&&);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:11: note: passing argument to parameter here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
import Cpp library "move_only_param_type.h";
|
||||
|
||||
fn F(c: Cpp.C) {
|
||||
// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk]
|
||||
// CHECK:STDERR: Cpp.foo(c);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(c);
|
||||
}
|
||||
|
||||
// --- fail_pass_move_only_param_ref.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'C' [CppInteropParseError]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^~~
|
||||
// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'C' has a user-declared move constructor [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | C(C&&);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:11: note: passing argument to parameter here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
import Cpp library "move_only_param_type.h";
|
||||
|
||||
fn F(ref c: Cpp.C) {
|
||||
// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk]
|
||||
// CHECK:STDERR: Cpp.foo(c);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(c);
|
||||
}
|
||||
|
||||
// --- fail_todo_pass_move_only_param_ref_by_move.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:6: error: call to implicitly-deleted copy constructor of 'C' [CppInteropParseError]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^~~
|
||||
// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'C' has a user-declared move constructor [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | C(C&&);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./move_only_param_type.h:6:11: note: passing argument to parameter here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 6 | auto foo(C) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
import Cpp library "move_only_param_type.h";
|
||||
|
||||
fn F(ref c: Cpp.C) {
|
||||
// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk]
|
||||
// CHECK:STDERR: Cpp.foo(Cpp.move(ref c));
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(Cpp.move(ref c));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Defined class with a single data member as parameter type
|
||||
// ============================================================================
|
||||
@@ -565,6 +669,58 @@ fn F() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- pass_move_only_param_temporary.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %make.cpp_overload_set.type: type = cpp_overload_set_type @make.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %make.cpp_overload_set.value: %make.cpp_overload_set.type = cpp_overload_set_value @make.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %make__carbon_thunk.type: type = fn_type @make__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %make__carbon_thunk: %make__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .make = %make.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %make.cpp_overload_set.value: %make.cpp_overload_set.type = cpp_overload_set_value @make.cpp_overload_set [concrete = constants.%make.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %make__carbon_thunk.decl: %make__carbon_thunk.type = fn_decl @make__carbon_thunk [concrete = constants.%make__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %make.ref: %make.cpp_overload_set.type = name_ref make, imports.%make.cpp_overload_set.value [concrete = constants.%make.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %addr.loc8_20: %ptr.d9e = addr_of %_.var
|
||||
// CHECK:STDOUT: %make__carbon_thunk.call: init %empty_tuple.type = call imports.%make__carbon_thunk.decl(%addr.loc8_20)
|
||||
// CHECK:STDOUT: %.loc8: init %C to %_.var = mark_in_place_init %make__carbon_thunk.call
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %addr.loc8_21: %ptr.d9e = addr_of %_.var
|
||||
// CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_21)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- import_definition_single_data_member_value_param_type.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
|
||||
@@ -338,6 +338,7 @@ fn Call() {
|
||||
// CHECK:STDOUT: %bound_method.loc10_16: <bound method> = bound_method %.loc10_7.2, %B.ref [concrete = constants.%bound_method.a5d]
|
||||
// CHECK:STDOUT: %int_1.loc10: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %int_2.loc10: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
|
||||
// CHECK:STDOUT: %.loc10_7.3: %X = acquire_value %.loc10_7.2 [concrete = constants.%X.val]
|
||||
// CHECK:STDOUT: %impl.elem0.loc10_19: %.9db = impl_witness_access constants.%ImplicitAs.impl_witness.ac5, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f1a]
|
||||
// CHECK:STDOUT: %bound_method.loc10_19.1: <bound method> = bound_method %int_1.loc10, %impl.elem0.loc10_19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.d43]
|
||||
// CHECK:STDOUT: %specific_fn.loc10_19: <specific function> = specific_function %impl.elem0.loc10_19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
@@ -352,7 +353,7 @@ fn Call() {
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_22: init %i32 = call %bound_method.loc10_22.2(%int_2.loc10) [concrete = constants.%int_2.ef8]
|
||||
// CHECK:STDOUT: %.loc10_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc10_22 [concrete = constants.%int_2.ef8]
|
||||
// CHECK:STDOUT: %.loc10_22.2: %i32 = converted %int_2.loc10, %.loc10_22.1 [concrete = constants.%int_2.ef8]
|
||||
// CHECK:STDOUT: %X.B.call: init %empty_tuple.type = call imports.%X.B.decl(%.loc10_7.2, %.loc10_19.2, %.loc10_22.2)
|
||||
// CHECK:STDOUT: %X.B.call: init %empty_tuple.type = call imports.%X.B.decl(%.loc10_7.3, %.loc10_19.2, %.loc10_22.2)
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %X.ref.loc11: type = name_ref X, imports.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %C.ref: %X.C.cpp_overload_set.type = name_ref C, imports.%X.C.cpp_overload_set.value [concrete = constants.%X.C.cpp_overload_set.value]
|
||||
@@ -591,13 +592,13 @@ fn Call() {
|
||||
// CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
|
||||
// CHECK:STDOUT: %X.B.cpp_overload_set.value: %X.B.cpp_overload_set.type = cpp_overload_set_value @X.B.cpp_overload_set [concrete = constants.%X.B.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %B__carbon_thunk.decl: %B__carbon_thunk.type = fn_decl @B__carbon_thunk [concrete = constants.%B__carbon_thunk] {
|
||||
// CHECK:STDOUT: %this.param_patt: %pattern_type.46b = ref_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %this.param_patt: %pattern_type.46b = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %this.patt: %pattern_type.46b = at_binding_pattern this, %this.param_patt [concrete]
|
||||
// CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.7ce = at_binding_pattern a, %a.param_patt [concrete]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %this.param: ref %X = ref_param call_param0
|
||||
// CHECK:STDOUT: %this: ref %X = ref_binding this, %this.param
|
||||
// CHECK:STDOUT: %this.param: %X = value_param call_param0
|
||||
// CHECK:STDOUT: %this: %X = value_binding this, %this.param
|
||||
// CHECK:STDOUT: %a.param: %i32 = value_param call_param1
|
||||
// CHECK:STDOUT: %.1: type = splice_block %i32.2 [concrete = constants.%i32] {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
|
||||
@@ -756,6 +757,7 @@ fn Call() {
|
||||
// CHECK:STDOUT: %B.ref: %X.B.cpp_overload_set.type = name_ref B, imports.%X.B.cpp_overload_set.value [concrete = constants.%X.B.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc11_16: <bound method> = bound_method %.loc11_7.2, %B.ref [concrete = constants.%bound_method.a5d]
|
||||
// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %.loc11_7.3: %X = acquire_value %.loc11_7.2 [concrete = constants.%X.val]
|
||||
// CHECK:STDOUT: %impl.elem0.loc11: %.9db = impl_witness_access constants.%ImplicitAs.impl_witness.ac5, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f1a]
|
||||
// CHECK:STDOUT: %bound_method.loc11_19.1: <bound method> = bound_method %int_1.loc11, %impl.elem0.loc11 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.d43]
|
||||
// CHECK:STDOUT: %specific_fn.loc11: <specific function> = specific_function %impl.elem0.loc11, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
@@ -763,7 +765,7 @@ fn Call() {
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc11: init %i32 = call %bound_method.loc11_19.2(%int_1.loc11) [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc11_19.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc11 [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %.loc11_19.2: %i32 = converted %int_1.loc11, %.loc11_19.1 [concrete = constants.%int_1.5d2]
|
||||
// CHECK:STDOUT: %B__carbon_thunk.call: init %empty_tuple.type = call imports.%B__carbon_thunk.decl(%.loc11_7.2, %.loc11_19.2)
|
||||
// CHECK:STDOUT: %B__carbon_thunk.call: init %empty_tuple.type = call imports.%B__carbon_thunk.decl(%.loc11_7.3, %.loc11_19.2)
|
||||
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %X.ref.loc12: type = name_ref X, imports.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %C.ref: %X.C.cpp_overload_set.type = name_ref C, imports.%X.C.cpp_overload_set.value [concrete = constants.%X.C.cpp_overload_set.value]
|
||||
@@ -821,9 +823,9 @@ fn Call() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @GlobalNoReturn__carbon_thunk.2(%a.param: %i32, %b.param: %i32, %c.param: %i32);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @X.B(%self.param: ref %X, %a.param: %i32);
|
||||
// CHECK:STDOUT: fn @X.B(%self.param: %X, %a.param: %i32);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @B__carbon_thunk(%this.param: ref %X, %a.param: %i32);
|
||||
// CHECK:STDOUT: fn @B__carbon_thunk(%this.param: %X, %a.param: %i32);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @X.C(%a.param: %i32);
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -31,7 +31,7 @@ auto foo(short a) -> void;
|
||||
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:6> 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'a' 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit always_inline
|
||||
// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foos.carbon_thunk"
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foos.carbon_thunk._"
|
||||
// CHECK:STDOUT: TranslationUnitDecl {{0x[a-f0-9]+}} <<invalid sloc>> <invalid sloc>
|
||||
// CHECK:STDOUT: |-NamespaceDecl {{0x[a-f0-9]+}} <<invalid sloc>> <invalid sloc> Carbon
|
||||
|
||||
@@ -58,7 +58,7 @@ auto foo() -> short;
|
||||
// CHECK:STDOUT: | `-DeclRefExpr {{0x[a-f0-9]+}} <col:6> 'short * _Nonnull':'short *' lvalue ParmVar {{0x[a-f0-9]+}} 'return' 'short * _Nonnull':'short *'
|
||||
// CHECK:STDOUT: |-AlwaysInlineAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit always_inline
|
||||
// CHECK:STDOUT: |-InternalLinkageAttr {{0x[a-f0-9]+}} <<invalid sloc>> Implicit
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foov.carbon_thunk"
|
||||
// CHECK:STDOUT: `-AsmLabelAttr {{0x[a-f0-9]+}} <col:6> Implicit "_Z3foov.carbon_thunk."
|
||||
|
||||
// --- import_return_thunk_required.carbon
|
||||
|
||||
|
||||
+31
-31
@@ -1128,14 +1128,14 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) {
|
||||
// CHECK:STDOUT: %.0d7: type = fn_type_with_self_type %Negate.WithSelf.Op.type.899, %Negate.facet.758 [symbolic]
|
||||
// CHECK:STDOUT: %impl.elem1.ec8: %.0d7 = impl_witness_access %Negate.lookup_impl_witness.783, element1 [symbolic]
|
||||
// CHECK:STDOUT: %specific_impl_fn.f22: <specific function> = specific_impl_function %impl.elem1.ec8, @Negate.WithSelf.Op(%Negate.facet.758) [symbolic]
|
||||
// CHECK:STDOUT: %Int32.cpp_operator.type.49e401.16: type = fn_type @Int32.cpp_operator.16 [concrete]
|
||||
// CHECK:STDOUT: %Int32.cpp_operator.0010d3.16: %Int32.cpp_operator.type.49e401.16 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.934: <witness> = custom_witness (%Int32.cpp_operator.0010d3.16), @Inc [concrete]
|
||||
// CHECK:STDOUT: %Inc.facet.390: %Inc.type = facet_value %Int32, (%custom_witness.934) [concrete]
|
||||
// CHECK:STDOUT: %Int32.cpp_operator.type.49e401.17: type = fn_type @Int32.cpp_operator.17 [concrete]
|
||||
// CHECK:STDOUT: %Int32.cpp_operator.0010d3.17: %Int32.cpp_operator.type.49e401.17 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.99f: <witness> = custom_witness (%Int32.cpp_operator.0010d3.17), @Dec [concrete]
|
||||
// CHECK:STDOUT: %Dec.facet.961: %Dec.type = facet_value %Int32, (%custom_witness.99f) [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.type.68b858.18: type = fn_type @Int32.Op.18 [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.6afff1.18: %Int32.Op.type.68b858.18 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.50d: <witness> = custom_witness (%Int32.Op.6afff1.18), @Inc [concrete]
|
||||
// CHECK:STDOUT: %Inc.facet.9db: %Inc.type = facet_value %Int32, (%custom_witness.50d) [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.type.68b858.19: type = fn_type @Int32.Op.19 [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.6afff1.19: %Int32.Op.type.68b858.19 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.e76: <witness> = custom_witness (%Int32.Op.6afff1.19), @Dec [concrete]
|
||||
// CHECK:STDOUT: %Dec.facet.bed: %Dec.type = facet_value %Int32, (%custom_witness.e76) [concrete]
|
||||
// CHECK:STDOUT: %facet_type.89a: type = facet_type <@Destroy & @Negate where %impl.elem0.f00 = %Int64> [concrete]
|
||||
// CHECK:STDOUT: %Int16.Op.type.180c8b.18: type = fn_type @Int16.Op.18 [concrete]
|
||||
// CHECK:STDOUT: %Int16.Op.c3e49c.18: %Int16.Op.type.180c8b.18 = struct_value () [concrete]
|
||||
@@ -1143,9 +1143,9 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) {
|
||||
// CHECK:STDOUT: %facet_value.70a: %facet_type.89a = facet_value %Int16, (%custom_witness.e5b, %custom_witness.e58) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.c49: type = pattern_type %facet_type.89a [concrete]
|
||||
// CHECK:STDOUT: %facet_type.d5d: type = facet_type <@Destroy & @Negate where %impl.elem0.f00 = %Int32> [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.type.68b858.18: type = fn_type @Int32.Op.18 [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.6afff1.18: %Int32.Op.type.68b858.18 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.e8a: <witness> = custom_witness (%Int32, %Int32.Op.6afff1.18), @Negate [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.type.68b858.20: type = fn_type @Int32.Op.20 [concrete]
|
||||
// CHECK:STDOUT: %Int32.Op.6afff1.20: %Int32.Op.type.68b858.20 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %custom_witness.e8a: <witness> = custom_witness (%Int32, %Int32.Op.6afff1.20), @Negate [concrete]
|
||||
// CHECK:STDOUT: %facet_value.396: %facet_type.d5d = facet_value %Int32, (%custom_witness.ce1, %custom_witness.e8a) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.0ec: type = pattern_type %facet_type.d5d [concrete]
|
||||
// CHECK:STDOUT: %complete_type.f1c: <witness> = complete_type_witness %AddWith.type.344 [concrete]
|
||||
@@ -1313,10 +1313,10 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) {
|
||||
// CHECK:STDOUT: %.384: type = fn_type_with_self_type %DivAssignWith.WithSelf.Op.type.646, %DivAssignWith.facet.d3b [concrete]
|
||||
// CHECK:STDOUT: %ModAssignWith.WithSelf.Op.type.a34: type = fn_type @ModAssignWith.WithSelf.Op, @ModAssignWith.WithSelf(%Int32, %ModAssignWith.facet.1c6) [concrete]
|
||||
// CHECK:STDOUT: %.ee0: type = fn_type_with_self_type %ModAssignWith.WithSelf.Op.type.a34, %ModAssignWith.facet.1c6 [concrete]
|
||||
// CHECK:STDOUT: %Inc.WithSelf.Op.type.eaa: type = fn_type @Inc.WithSelf.Op, @Inc.WithSelf(%Inc.facet.390) [concrete]
|
||||
// CHECK:STDOUT: %.696: type = fn_type_with_self_type %Inc.WithSelf.Op.type.eaa, %Inc.facet.390 [concrete]
|
||||
// CHECK:STDOUT: %Dec.WithSelf.Op.type.6fb: type = fn_type @Dec.WithSelf.Op, @Dec.WithSelf(%Dec.facet.961) [concrete]
|
||||
// CHECK:STDOUT: %.cdd: type = fn_type_with_self_type %Dec.WithSelf.Op.type.6fb, %Dec.facet.961 [concrete]
|
||||
// CHECK:STDOUT: %Inc.WithSelf.Op.type.755: type = fn_type @Inc.WithSelf.Op, @Inc.WithSelf(%Inc.facet.9db) [concrete]
|
||||
// CHECK:STDOUT: %.cfd3: type = fn_type_with_self_type %Inc.WithSelf.Op.type.755, %Inc.facet.9db [concrete]
|
||||
// CHECK:STDOUT: %Dec.WithSelf.Op.type.e71: type = fn_type @Dec.WithSelf.Op, @Dec.WithSelf(%Dec.facet.bed) [concrete]
|
||||
// CHECK:STDOUT: %.b6e: type = fn_type_with_self_type %Dec.WithSelf.Op.type.e71, %Dec.facet.bed [concrete]
|
||||
// CHECK:STDOUT: %Negate.facet.0a5: %Negate.type = facet_value %Int16, (%custom_witness.e58) [concrete]
|
||||
// CHECK:STDOUT: %Negate.WithSelf.Op.type.d7d: type = fn_type @Negate.WithSelf.Op, @Negate.WithSelf(%Negate.facet.0a5) [concrete]
|
||||
// CHECK:STDOUT: %.3e7: type = fn_type_with_self_type %Negate.WithSelf.Op.type.d7d, %Negate.facet.0a5 [concrete]
|
||||
@@ -3763,32 +3763,32 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) {
|
||||
// CHECK:STDOUT: %pattern_type.loc294_22 => constants.%pattern_type.ece
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @TestInc(constants.%Inc.facet.390) {
|
||||
// CHECK:STDOUT: %T.loc278_13.1 => constants.%Inc.facet.390
|
||||
// CHECK:STDOUT: specific @TestInc(constants.%Inc.facet.9db) {
|
||||
// CHECK:STDOUT: %T.loc278_13.1 => constants.%Inc.facet.9db
|
||||
// CHECK:STDOUT: %T.as_type.loc278_33.1 => constants.%Int32
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.9c9
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.357
|
||||
// CHECK:STDOUT: %Inc.WithSelf.Op.type => constants.%Inc.WithSelf.Op.type.eaa
|
||||
// CHECK:STDOUT: %.loc280 => constants.%.696
|
||||
// CHECK:STDOUT: %Inc.lookup_impl_witness => constants.%custom_witness.934
|
||||
// CHECK:STDOUT: %impl.elem0.loc280_3.2 => constants.%Int32.cpp_operator.0010d3.16
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc280_3.2 => constants.%Int32.cpp_operator.0010d3.16
|
||||
// CHECK:STDOUT: %Inc.WithSelf.Op.type => constants.%Inc.WithSelf.Op.type.755
|
||||
// CHECK:STDOUT: %.loc280 => constants.%.cfd3
|
||||
// CHECK:STDOUT: %Inc.lookup_impl_witness => constants.%custom_witness.50d
|
||||
// CHECK:STDOUT: %impl.elem0.loc280_3.2 => constants.%Int32.Op.6afff1.18
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc280_3.2 => constants.%Int32.Op.6afff1.18
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @TestDec(constants.%Dec.facet.961) {
|
||||
// CHECK:STDOUT: %T.loc284_13.1 => constants.%Dec.facet.961
|
||||
// CHECK:STDOUT: specific @TestDec(constants.%Dec.facet.bed) {
|
||||
// CHECK:STDOUT: %T.loc284_13.1 => constants.%Dec.facet.bed
|
||||
// CHECK:STDOUT: %T.as_type.loc284_33.1 => constants.%Int32
|
||||
// CHECK:STDOUT: %pattern_type => constants.%pattern_type.9c9
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %require_complete => constants.%complete_type.357
|
||||
// CHECK:STDOUT: %Dec.WithSelf.Op.type => constants.%Dec.WithSelf.Op.type.6fb
|
||||
// CHECK:STDOUT: %.loc286 => constants.%.cdd
|
||||
// CHECK:STDOUT: %Dec.lookup_impl_witness => constants.%custom_witness.99f
|
||||
// CHECK:STDOUT: %impl.elem0.loc286_3.2 => constants.%Int32.cpp_operator.0010d3.17
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc286_3.2 => constants.%Int32.cpp_operator.0010d3.17
|
||||
// CHECK:STDOUT: %Dec.WithSelf.Op.type => constants.%Dec.WithSelf.Op.type.e71
|
||||
// CHECK:STDOUT: %.loc286 => constants.%.b6e
|
||||
// CHECK:STDOUT: %Dec.lookup_impl_witness => constants.%custom_witness.e76
|
||||
// CHECK:STDOUT: %impl.elem0.loc286_3.2 => constants.%Int32.Op.6afff1.19
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc286_3.2 => constants.%Int32.Op.6afff1.19
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: specific @TestNegate(constants.%Destroy.facet.b0a, constants.%facet_value.70a) {
|
||||
@@ -3834,8 +3834,8 @@ fn TestUnaryOperators(a: Cpp.Int16, b: Cpp.Int32) {
|
||||
// CHECK:STDOUT: %Negate.facet => constants.%Negate.facet.3c9
|
||||
// CHECK:STDOUT: %Negate.WithSelf.Op.type => constants.%Negate.WithSelf.Op.type.1bc
|
||||
// CHECK:STDOUT: %.loc296_3.3 => constants.%.19b
|
||||
// CHECK:STDOUT: %impl.elem1.loc296_3.2 => constants.%Int32.Op.6afff1.18
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc296_3.3 => constants.%Int32.Op.6afff1.18
|
||||
// CHECK:STDOUT: %impl.elem1.loc296_3.2 => constants.%Int32.Op.6afff1.20
|
||||
// CHECK:STDOUT: %specific_impl_fn.loc296_3.3 => constants.%Int32.Op.6afff1.20
|
||||
// CHECK:STDOUT: %Destroy.WithSelf.Op.type => constants.%Destroy.WithSelf.Op.type.2e1
|
||||
// CHECK:STDOUT: %.loc296_3.4 => constants.%.e6c
|
||||
// CHECK:STDOUT: %Destroy.lookup_impl_witness => constants.%custom_witness.ce1
|
||||
|
||||
@@ -175,8 +175,7 @@ fn TestDerefFail(not_ptr: Cpp.NotAPtr) {
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_ptr.ref, %impl.elem1
|
||||
// CHECK:STDOUT: %Op.ref.loc13_43: %ConstDeref.cpp_operator.type = name_ref Op, imports.%ConstDeref.cpp_operator.decl [concrete = constants.%ConstDeref.cpp_operator]
|
||||
// CHECK:STDOUT: %ConstDeref.cpp_operator.bound: <bound method> = bound_method %int_ptr.ref, %Op.ref.loc13_43
|
||||
// CHECK:STDOUT: %.loc13: %ConstDeref = acquire_value %int_ptr.ref
|
||||
// CHECK:STDOUT: %operator_Star__carbon_thunk.call: ref %i32 = call imports.%operator_Star__carbon_thunk.decl(%.loc13)
|
||||
// CHECK:STDOUT: %operator_Star__carbon_thunk.call: ref %i32 = call imports.%operator_Star__carbon_thunk.decl(%int_ptr.ref)
|
||||
// CHECK:STDOUT: return %operator_Star__carbon_thunk.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+27
-15
@@ -1189,6 +1189,7 @@ fn F() {
|
||||
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %i32.builtin: type = int_type signed, %int_32 [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %operator_LessLess__carbon_thunk.type: type = fn_type @operator_LessLess__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %operator_LessLess__carbon_thunk: %operator_LessLess__carbon_thunk.type = struct_value () [concrete]
|
||||
@@ -1252,8 +1253,12 @@ fn F() {
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.577: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.ImplicitAs.impl.Convert.f1a [concrete]
|
||||
// CHECK:STDOUT: %bound_method.cd5: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
||||
// CHECK:STDOUT: %int_42.c68: %i32 = int_value 42 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.1a9: ref %i32 = temporary invalid, %int_42.c68 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.bae255.2: type = fn_type @Destroy.Op.loc48_30.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.651ba6.2: %Destroy.Op.type.bae255.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.1a9, %Destroy.Op.651ba6.2 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.bae255.3: type = fn_type @Destroy.Op.loc45 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.651ba6.3: %Destroy.Op.type.bae255.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %C.cpp_destructor.type: type = fn_type @C.cpp_destructor [concrete]
|
||||
// CHECK:STDOUT: %C.cpp_destructor: %C.cpp_destructor.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %C.Op.type: type = fn_type @C.Op [concrete]
|
||||
@@ -1875,24 +1880,26 @@ fn F() {
|
||||
// CHECK:STDOUT: %specific_fn.loc48: <specific function> = specific_function %impl.elem0.loc48, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc48_30.2: <bound method> = bound_method %int_42, %specific_fn.loc48 [concrete = constants.%bound_method.cd5]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc48: init %i32 = call %bound_method.loc48_30.2(%int_42) [concrete = constants.%int_42.c68]
|
||||
// CHECK:STDOUT: %.loc48_30.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc48 [concrete = constants.%int_42.c68]
|
||||
// CHECK:STDOUT: %.loc48_30.2: %i32 = converted %int_42, %.loc48_30.1 [concrete = constants.%int_42.c68]
|
||||
// CHECK:STDOUT: %C.cpp_operator.call: init %i32 = call %C.cpp_operator.bound(%c1.ref.loc48, %.loc48_30.2)
|
||||
// CHECK:STDOUT: %.loc48_30.1: init %i32 = converted %int_42, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc48 [concrete = constants.%int_42.c68]
|
||||
// CHECK:STDOUT: %.loc48_30.2: ref %i32 = temporary_storage
|
||||
// CHECK:STDOUT: %.loc48_30.3: ref %i32 = temporary %.loc48_30.2, %.loc48_30.1 [concrete = constants.%.1a9]
|
||||
// CHECK:STDOUT: %C.cpp_operator.call: init %i32 = call %C.cpp_operator.bound(%c1.ref.loc48, %.loc48_30.3)
|
||||
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %.loc48_32.1: %i32 = value_of_initializer %C.cpp_operator.call
|
||||
// CHECK:STDOUT: %.loc48_32.2: %i32 = converted %C.cpp_operator.call, %.loc48_32.1
|
||||
// CHECK:STDOUT: %index: %i32 = value_binding index, %.loc48_32.2
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc45: <bound method> = bound_method %.loc45_44.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc48: init %empty_tuple.type = call constants.%Destroy.Op.bound(constants.%.1a9)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc45: <bound method> = bound_method %.loc45_44.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc45: init %empty_tuple.type = call %Destroy.Op.bound.loc45(%.loc45_44.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc44: <bound method> = bound_method %.loc44_47.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc44: <bound method> = bound_method %.loc44_47.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc44: init %empty_tuple.type = call %Destroy.Op.bound.loc44(%.loc44_47.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc43: <bound method> = bound_method %.loc43_35.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc43: <bound method> = bound_method %.loc43_35.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc43: init %empty_tuple.type = call %Destroy.Op.bound.loc43(%.loc43_35.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc42: <bound method> = bound_method %.loc42_38.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc42: <bound method> = bound_method %.loc42_38.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc42: init %empty_tuple.type = call %Destroy.Op.bound.loc42(%.loc42_38.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc41: <bound method> = bound_method %.loc41_35.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc41: <bound method> = bound_method %.loc41_35.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc41: init %empty_tuple.type = call %Destroy.Op.bound.loc41(%.loc41_35.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc40: <bound method> = bound_method %.loc40_31.3, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.bound.loc40: <bound method> = bound_method %.loc40_31.3, constants.%Destroy.Op.651ba6.3
|
||||
// CHECK:STDOUT: %Destroy.Op.call.loc40: init %empty_tuple.type = call %Destroy.Op.bound.loc40(%.loc40_31.3)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %C.Op.bound.loc23: <bound method> = bound_method %.loc23_38.3, constants.%C.Op
|
||||
@@ -1946,7 +1953,14 @@ fn F() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op(%self.param: ref bool) = "no_op";
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc48_30.1(%self.param: ref %i32.builtin) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc48_30.2(%self.param: ref %i32) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc45(%self.param: ref bool) = "no_op";
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- multiple_calls.carbon
|
||||
// CHECK:STDOUT:
|
||||
@@ -3175,9 +3189,7 @@ fn F() {
|
||||
// CHECK:STDOUT: %c2.ref: ref %C = name_ref c2, %c2
|
||||
// CHECK:STDOUT: %C.cpp_operator.bound.loc10: <bound method> = bound_method %c1.ref.loc10, imports.%C.cpp_operator.decl.828f43.2
|
||||
// CHECK:STDOUT: %.loc10_3: ref %C = splice_block %c3.var {}
|
||||
// CHECK:STDOUT: %.loc10_31.1: %C = acquire_value %c2.ref
|
||||
// CHECK:STDOUT: %.loc10_31.2: ref %C = value_as_ref %.loc10_31.1
|
||||
// CHECK:STDOUT: %addr.loc10_29.1: %ptr.d9e = addr_of %.loc10_31.2
|
||||
// CHECK:STDOUT: %addr.loc10_29.1: %ptr.d9e = addr_of %c2.ref
|
||||
// CHECK:STDOUT: %addr.loc10_29.2: %ptr.d9e = addr_of %.loc10_3
|
||||
// CHECK:STDOUT: %operator_Plus__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_Plus__carbon_thunk.decl(%c1.ref.loc10, %addr.loc10_29.1, %addr.loc10_29.2)
|
||||
// CHECK:STDOUT: %.loc10_29: init %C to %.loc10_3 = mark_in_place_init %operator_Plus__carbon_thunk.call
|
||||
|
||||
@@ -377,26 +377,13 @@ fn Test(missing_less: Cpp.MissingLess,
|
||||
// CHECK:STDERR:
|
||||
OrderedWith(no_relevant_members, no_relevant_members);
|
||||
|
||||
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+20]]:3: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+7]]:3: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: OrderedWith(less_returns_void, less_returns_void);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-62]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: fn OrderedWith[U:! type, T:! Core.OrderedWith(U)](x: T, y: U) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:26:11: error: value expression passed to reference parameter [ValueForRefParam]
|
||||
// CHECK:STDERR: fn Less[self: Self](other: Other) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-76]]:8: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto operator<(LessNonConst) -> bool;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:26:3: note: while building thunk to match the signature of this function [ThunkSignature]
|
||||
// CHECK:STDERR: fn Less[self: Self](other: Other) -> bool;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-75]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: fn OrderedWith[U:! type, T:! Core.OrderedWith(U)](x: T, y: U) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
OrderedWith(less_returns_void, less_returns_void);
|
||||
|
||||
OrderedWith(less_non_const, less_non_const);
|
||||
|
||||
Reference in New Issue
Block a user