|
|
@@ -69,6 +69,19 @@ fn F() {
|
|
|
//@dump-sem-ir-end
|
|
|
}
|
|
|
|
|
|
+// --- copy_long_long.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+import Cpp;
|
|
|
+
|
|
|
+fn CopyLongLong() {
|
|
|
+ //@dump-sem-ir-begin
|
|
|
+ var a: Cpp.long_long = 1;
|
|
|
+ var b: Cpp.long_long = a;
|
|
|
+ //@dump-sem-ir-end
|
|
|
+}
|
|
|
+
|
|
|
// --- unsigned_long_long.carbon
|
|
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
@@ -97,6 +110,19 @@ fn F() {
|
|
|
//@dump-sem-ir-end
|
|
|
}
|
|
|
|
|
|
+// --- copy_unsigned_long_long.carbon
|
|
|
+
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+import Cpp;
|
|
|
+
|
|
|
+fn CopyUnsignedLongLong() {
|
|
|
+ //@dump-sem-ir-begin
|
|
|
+ var a: Cpp.unsigned_long_long = 1;
|
|
|
+ var b: Cpp.unsigned_long_long = a;
|
|
|
+ //@dump-sem-ir-end
|
|
|
+}
|
|
|
+
|
|
|
// CHECK:STDOUT: --- long.carbon
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: constants {
|
|
|
@@ -724,6 +750,87 @@ fn F() {
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: fn @DestroyOp.loc19(%self.param: %LongLongResult) = "no_op";
|
|
|
// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: --- copy_long_long.carbon
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: constants {
|
|
|
+// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.long_long: type = class_type @LongLong64 [concrete]
|
|
|
+// CHECK:STDOUT: %pattern_type.76e: type = pattern_type %Cpp.long_long [concrete]
|
|
|
+// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type.a03: type = facet_type <@ImplicitAs, @ImplicitAs(%Cpp.long_long)> [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.Convert.type.6e4: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Cpp.long_long) [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.impl_witness.82e: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.896 [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.a03 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.82e) [concrete]
|
|
|
+// CHECK:STDOUT: %.a93: type = fn_type_with_self_type %ImplicitAs.Convert.type.6e4, %ImplicitAs.facet [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert [concrete]
|
|
|
+// CHECK:STDOUT: %int_1.092: %Cpp.long_long = int_value 1 [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.impl_witness.6d4: <witness> = impl_witness imports.%Copy.impl_witness_table.804 [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %Cpp.long_long, (%Copy.impl_witness.6d4) [concrete]
|
|
|
+// CHECK:STDOUT: %.26f: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.long_long.as.Copy.impl.Op.type: type = fn_type @Cpp.long_long.as.Copy.impl.Op [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.long_long.as.Copy.impl.Op: %Cpp.long_long.as.Copy.impl.Op.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
|
|
+// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: imports {
|
|
|
+// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
|
+// CHECK:STDOUT: .long_long = constants.%Cpp.long_long
|
|
|
+// CHECK:STDOUT: import Cpp//...
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %Core.import_ref.d64: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type = import_ref Core//prelude/types/cpp/int, loc{{\d+_\d+}}, loaded [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.impl_witness_table.896 = impl_witness_table (%Core.import_ref.d64), @Core.IntLiteral.as.ImplicitAs.impl.a26 [concrete]
|
|
|
+// CHECK:STDOUT: %Core.import_ref.7a9: %Cpp.long_long.as.Copy.impl.Op.type = import_ref Core//prelude/types/cpp/int, loc{{\d+_\d+}}, loaded [concrete = constants.%Cpp.long_long.as.Copy.impl.Op]
|
|
|
+// CHECK:STDOUT: %Copy.impl_witness_table.804 = impl_witness_table (%Core.import_ref.7a9), @Cpp.long_long.as.Copy.impl [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn @CopyLongLong() {
|
|
|
+// CHECK:STDOUT: !entry:
|
|
|
+// CHECK:STDOUT: name_binding_decl {
|
|
|
+// CHECK:STDOUT: %a.patt: %pattern_type.76e = ref_binding_pattern a [concrete]
|
|
|
+// CHECK:STDOUT: %a.var_patt: %pattern_type.76e = var_pattern %a.patt [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %a.var: ref %Cpp.long_long = var %a.var_patt
|
|
|
+// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
|
|
+// CHECK:STDOUT: %impl.elem0.loc8: %.a93 = impl_witness_access constants.%ImplicitAs.impl_witness.82e, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert]
|
|
|
+// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %int_1, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %Cpp.long_long = call %bound_method.loc8(%int_1) [concrete = constants.%int_1.092]
|
|
|
+// CHECK:STDOUT: %.loc8_3: init %Cpp.long_long = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.092]
|
|
|
+// CHECK:STDOUT: assign %a.var, %.loc8_3
|
|
|
+// CHECK:STDOUT: %.loc8_13: type = splice_block %long_long.ref.loc8 [concrete = constants.%Cpp.long_long] {
|
|
|
+// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
|
+// CHECK:STDOUT: %long_long.ref.loc8: type = name_ref long_long, constants.%Cpp.long_long [concrete = constants.%Cpp.long_long]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %a: ref %Cpp.long_long = ref_binding a, %a.var
|
|
|
+// CHECK:STDOUT: name_binding_decl {
|
|
|
+// CHECK:STDOUT: %b.patt: %pattern_type.76e = ref_binding_pattern b [concrete]
|
|
|
+// CHECK:STDOUT: %b.var_patt: %pattern_type.76e = var_pattern %b.patt [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %b.var: ref %Cpp.long_long = var %b.var_patt
|
|
|
+// CHECK:STDOUT: %a.ref: ref %Cpp.long_long = name_ref a, %a
|
|
|
+// CHECK:STDOUT: %.loc9_26: %Cpp.long_long = acquire_value %a.ref
|
|
|
+// CHECK:STDOUT: %impl.elem0.loc9: %.26f = impl_witness_access constants.%Copy.impl_witness.6d4, element0 [concrete = constants.%Cpp.long_long.as.Copy.impl.Op]
|
|
|
+// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_26, %impl.elem0.loc9
|
|
|
+// CHECK:STDOUT: %Cpp.long_long.as.Copy.impl.Op.call: init %Cpp.long_long = call %bound_method.loc9(%.loc9_26)
|
|
|
+// CHECK:STDOUT: assign %b.var, %Cpp.long_long.as.Copy.impl.Op.call
|
|
|
+// CHECK:STDOUT: %.loc9_13: type = splice_block %long_long.ref.loc9 [concrete = constants.%Cpp.long_long] {
|
|
|
+// CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
|
+// CHECK:STDOUT: %long_long.ref.loc9: type = name_ref long_long, constants.%Cpp.long_long [concrete = constants.%Cpp.long_long]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %b: ref %Cpp.long_long = ref_binding b, %b.var
|
|
|
+// CHECK:STDOUT: %DestroyOp.bound.loc9: <bound method> = bound_method %b.var, constants.%DestroyOp
|
|
|
+// CHECK:STDOUT: %DestroyOp.call.loc9: init %empty_tuple.type = call %DestroyOp.bound.loc9(%b.var)
|
|
|
+// CHECK:STDOUT: %DestroyOp.bound.loc8: <bound method> = bound_method %a.var, constants.%DestroyOp
|
|
|
+// CHECK:STDOUT: %DestroyOp.call.loc8: init %empty_tuple.type = call %DestroyOp.bound.loc8(%a.var)
|
|
|
+// CHECK:STDOUT: <elided>
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn @DestroyOp(%self.param: %Cpp.long_long) = "no_op";
|
|
|
+// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: --- unsigned_long_long.carbon
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: constants {
|
|
|
@@ -1019,3 +1126,84 @@ fn F() {
|
|
|
// CHECK:STDOUT:
|
|
|
// CHECK:STDOUT: fn @DestroyOp.loc19(%self.param: %ULongLongResult) = "no_op";
|
|
|
// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: --- copy_unsigned_long_long.carbon
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: constants {
|
|
|
+// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.unsigned_long_long: type = class_type @ULongLong64 [concrete]
|
|
|
+// CHECK:STDOUT: %pattern_type.ebd: type = pattern_type %Cpp.unsigned_long_long [concrete]
|
|
|
+// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.type.407: type = facet_type <@ImplicitAs, @ImplicitAs(%Cpp.unsigned_long_long)> [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.Convert.type.c4b: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%Cpp.unsigned_long_long) [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.impl_witness.438: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.517 [concrete]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.407 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.438) [concrete]
|
|
|
+// CHECK:STDOUT: %.dd7: type = fn_type_with_self_type %ImplicitAs.Convert.type.c4b, %ImplicitAs.facet [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.ImplicitAs.impl.Convert [concrete]
|
|
|
+// CHECK:STDOUT: %int_1.79a: %Cpp.unsigned_long_long = int_value 1 [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.impl_witness.95c: <witness> = impl_witness imports.%Copy.impl_witness_table.759 [concrete]
|
|
|
+// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %Cpp.unsigned_long_long, (%Copy.impl_witness.95c) [concrete]
|
|
|
+// CHECK:STDOUT: %.429: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.unsigned_long_long.as.Copy.impl.Op.type: type = fn_type @Cpp.unsigned_long_long.as.Copy.impl.Op [concrete]
|
|
|
+// CHECK:STDOUT: %Cpp.unsigned_long_long.as.Copy.impl.Op: %Cpp.unsigned_long_long.as.Copy.impl.Op.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
|
|
|
+// CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: imports {
|
|
|
+// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
|
+// CHECK:STDOUT: .unsigned_long_long = constants.%Cpp.unsigned_long_long
|
|
|
+// CHECK:STDOUT: import Cpp//...
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %Core.import_ref.7bd: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type = import_ref Core//prelude/types/cpp/int, loc{{\d+_\d+}}, loaded [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert]
|
|
|
+// CHECK:STDOUT: %ImplicitAs.impl_witness_table.517 = impl_witness_table (%Core.import_ref.7bd), @Core.IntLiteral.as.ImplicitAs.impl.45d [concrete]
|
|
|
+// CHECK:STDOUT: %Core.import_ref.ffa: %Cpp.unsigned_long_long.as.Copy.impl.Op.type = import_ref Core//prelude/types/cpp/int, loc{{\d+_\d+}}, loaded [concrete = constants.%Cpp.unsigned_long_long.as.Copy.impl.Op]
|
|
|
+// CHECK:STDOUT: %Copy.impl_witness_table.759 = impl_witness_table (%Core.import_ref.ffa), @Cpp.unsigned_long_long.as.Copy.impl [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn @CopyUnsignedLongLong() {
|
|
|
+// CHECK:STDOUT: !entry:
|
|
|
+// CHECK:STDOUT: name_binding_decl {
|
|
|
+// CHECK:STDOUT: %a.patt: %pattern_type.ebd = ref_binding_pattern a [concrete]
|
|
|
+// CHECK:STDOUT: %a.var_patt: %pattern_type.ebd = var_pattern %a.patt [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %a.var: ref %Cpp.unsigned_long_long = var %a.var_patt
|
|
|
+// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
|
|
+// CHECK:STDOUT: %impl.elem0.loc8: %.dd7 = impl_witness_access constants.%ImplicitAs.impl_witness.438, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert]
|
|
|
+// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %int_1, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
|
|
+// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %Cpp.unsigned_long_long = call %bound_method.loc8(%int_1) [concrete = constants.%int_1.79a]
|
|
|
+// CHECK:STDOUT: %.loc8_3: init %Cpp.unsigned_long_long = converted %int_1, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.79a]
|
|
|
+// CHECK:STDOUT: assign %a.var, %.loc8_3
|
|
|
+// CHECK:STDOUT: %.loc8_13: type = splice_block %unsigned_long_long.ref.loc8 [concrete = constants.%Cpp.unsigned_long_long] {
|
|
|
+// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
|
+// CHECK:STDOUT: %unsigned_long_long.ref.loc8: type = name_ref unsigned_long_long, constants.%Cpp.unsigned_long_long [concrete = constants.%Cpp.unsigned_long_long]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %a: ref %Cpp.unsigned_long_long = ref_binding a, %a.var
|
|
|
+// CHECK:STDOUT: name_binding_decl {
|
|
|
+// CHECK:STDOUT: %b.patt: %pattern_type.ebd = ref_binding_pattern b [concrete]
|
|
|
+// CHECK:STDOUT: %b.var_patt: %pattern_type.ebd = var_pattern %b.patt [concrete]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %b.var: ref %Cpp.unsigned_long_long = var %b.var_patt
|
|
|
+// CHECK:STDOUT: %a.ref: ref %Cpp.unsigned_long_long = name_ref a, %a
|
|
|
+// CHECK:STDOUT: %.loc9_35: %Cpp.unsigned_long_long = acquire_value %a.ref
|
|
|
+// CHECK:STDOUT: %impl.elem0.loc9: %.429 = impl_witness_access constants.%Copy.impl_witness.95c, element0 [concrete = constants.%Cpp.unsigned_long_long.as.Copy.impl.Op]
|
|
|
+// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_35, %impl.elem0.loc9
|
|
|
+// CHECK:STDOUT: %Cpp.unsigned_long_long.as.Copy.impl.Op.call: init %Cpp.unsigned_long_long = call %bound_method.loc9(%.loc9_35)
|
|
|
+// CHECK:STDOUT: assign %b.var, %Cpp.unsigned_long_long.as.Copy.impl.Op.call
|
|
|
+// CHECK:STDOUT: %.loc9_13: type = splice_block %unsigned_long_long.ref.loc9 [concrete = constants.%Cpp.unsigned_long_long] {
|
|
|
+// CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
|
+// CHECK:STDOUT: %unsigned_long_long.ref.loc9: type = name_ref unsigned_long_long, constants.%Cpp.unsigned_long_long [concrete = constants.%Cpp.unsigned_long_long]
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT: %b: ref %Cpp.unsigned_long_long = ref_binding b, %b.var
|
|
|
+// CHECK:STDOUT: %DestroyOp.bound.loc9: <bound method> = bound_method %b.var, constants.%DestroyOp
|
|
|
+// CHECK:STDOUT: %DestroyOp.call.loc9: init %empty_tuple.type = call %DestroyOp.bound.loc9(%b.var)
|
|
|
+// CHECK:STDOUT: %DestroyOp.bound.loc8: <bound method> = bound_method %a.var, constants.%DestroyOp
|
|
|
+// CHECK:STDOUT: %DestroyOp.call.loc8: init %empty_tuple.type = call %DestroyOp.bound.loc8(%a.var)
|
|
|
+// CHECK:STDOUT: <elided>
|
|
|
+// CHECK:STDOUT: }
|
|
|
+// CHECK:STDOUT:
|
|
|
+// CHECK:STDOUT: fn @DestroyOp(%self.param: %Cpp.unsigned_long_long) = "no_op";
|
|
|
+// CHECK:STDOUT:
|