mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
+6
-10
@@ -161,7 +161,7 @@ struct S {
|
||||
auto foo() -> void;
|
||||
};
|
||||
|
||||
// --- fail_todo_5891_import_function_member_public.carbon
|
||||
// --- import_function_member_public.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -169,11 +169,6 @@ import Cpp library "function_member_public.h";
|
||||
|
||||
fn F(s: Cpp.S*) {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_import_function_member_public.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: s->foo();
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_import_function_member_public.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
s->foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
@@ -432,7 +427,7 @@ fn F() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_5891_import_function_member_public.carbon
|
||||
// CHECK:STDOUT: --- import_function_member_public.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %S: type = class_type @S [concrete]
|
||||
@@ -456,10 +451,11 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F(%s.param: %ptr.5c7) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %s.ref: %ptr.5c7 = name_ref s, %s
|
||||
// CHECK:STDOUT: %.loc13: ref %S = deref %s.ref
|
||||
// CHECK:STDOUT: %.loc8: ref %S = deref %s.ref
|
||||
// CHECK:STDOUT: %foo.ref: %.177 = name_ref foo, imports.%.dcb [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %S.foo.call: init %empty_tuple.type = call imports.%S.foo.decl(<error>)
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8, %foo.ref
|
||||
// CHECK:STDOUT: %addr: %ptr.5c7 = addr_of %.loc8
|
||||
// CHECK:STDOUT: %S.foo.call: init %empty_tuple.type = call imports.%S.foo.decl(%addr)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+21
-27
@@ -10,8 +10,6 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/base.carbon
|
||||
|
||||
// TODO: Tests marked as `fail_todo_5891_` to fixed as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
|
||||
|
||||
// --- derived_to_base_conversion.h
|
||||
|
||||
class Base {};
|
||||
@@ -103,7 +101,7 @@ struct Derived : Base {
|
||||
void g() const;
|
||||
};
|
||||
|
||||
// --- fail_todo_5891_use_base_method.carbon
|
||||
// --- use_base_method.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -111,26 +109,12 @@ import Cpp library "base_method.h";
|
||||
|
||||
fn CallDirect(d: Cpp.Derived) {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_use_base_method.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: d.f();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_base_method.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
d.f();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn CallQualified(d: Cpp.Derived) {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_use_base_method.carbon:[[@LINE+9]]:3: error: member name of type `<type of Cpp.g>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
|
||||
// CHECK:STDERR: d.(Cpp.Base.g)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_5891_use_base_method.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: d.(Cpp.Base.g)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_base_method.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
d.(Cpp.Base.g)();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
@@ -472,7 +456,7 @@ class V {
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_base_method.carbon
|
||||
// CHECK:STDOUT: --- use_base_method.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
@@ -517,23 +501,33 @@ class V {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %f.ref: %.5b0 = name_ref f, imports.%.e54 [concrete = constants.%empty_struct.3f3]
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_7.1: %ptr.a97 = as_compatible %addr [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_7.2: %ptr.a97 = converted %addr, %.loc13_7.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc13_7.2)
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %f.ref
|
||||
// CHECK:STDOUT: %.loc8_3.1: ref %Base = class_element_access %d.ref, element0
|
||||
// CHECK:STDOUT: %.loc8_3.2: ref %Base = converted %d.ref, %.loc8_3.1
|
||||
// CHECK:STDOUT: %.loc8_3.3: %Base = bind_value %.loc8_3.2
|
||||
// CHECK:STDOUT: %.loc8_3.4: ref %Base = value_as_ref %.loc8_3.3
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of %.loc8_3.4
|
||||
// CHECK:STDOUT: %.loc8_7.1: %ptr.a97 = as_compatible %addr
|
||||
// CHECK:STDOUT: %.loc8_7.2: %ptr.a97 = converted %addr, %.loc8_7.1
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc8_7.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallQualified(%d.param: %Derived) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %Cpp.ref.loc28: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
|
||||
// CHECK:STDOUT: %g.ref: %.7c6 = name_ref g, imports.%.362 [concrete = constants.%empty_struct.49e]
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_18.1: %ptr.a97 = as_compatible %addr [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc28_18.2: %ptr.a97 = converted %addr, %.loc28_18.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %g__carbon_thunk.call: init %empty_tuple.type = call imports.%g__carbon_thunk.decl(%.loc28_18.2)
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %g.ref
|
||||
// CHECK:STDOUT: %.loc14_3.1: ref %Base = class_element_access %d.ref, element0
|
||||
// CHECK:STDOUT: %.loc14_3.2: ref %Base = converted %d.ref, %.loc14_3.1
|
||||
// CHECK:STDOUT: %.loc14_3.3: %Base = bind_value %.loc14_3.2
|
||||
// CHECK:STDOUT: %.loc14_3.4: ref %Base = value_as_ref %.loc14_3.3
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of %.loc14_3.4
|
||||
// CHECK:STDOUT: %.loc14_18.1: %ptr.a97 = as_compatible %addr
|
||||
// CHECK:STDOUT: %.loc14_18.2: %ptr.a97 = converted %addr, %.loc14_18.1
|
||||
// CHECK:STDOUT: %g__carbon_thunk.call: init %empty_tuple.type = call imports.%g__carbon_thunk.decl(%.loc14_18.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+77
-115
@@ -11,8 +11,6 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/method.carbon
|
||||
|
||||
// TODO: Tests marked as `fail_todo_5891_` to fixed as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
|
||||
|
||||
// --- object_param_qualifiers.h
|
||||
|
||||
struct HasQualifiers {
|
||||
@@ -27,7 +25,7 @@ struct HasQualifiers {
|
||||
void const_ref_ref_this() const&&;
|
||||
};
|
||||
|
||||
// --- fail_todo_5891_use_object_param_qualifiers.carbon
|
||||
// --- use_object_param_qualifiers.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -35,90 +33,60 @@ import Cpp library "object_param_qualifiers.h";
|
||||
|
||||
fn F(v: Cpp.HasQualifiers, p: Cpp.HasQualifiers*) {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: v.const_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
v.const_this();
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: v.const_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
v.const_ref_this();
|
||||
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: p->plain();
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
p->plain();
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: p->ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
p->ref_this();
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: p->const_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
p->const_this();
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: p->const_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_object_param_qualifiers.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
p->const_ref_this();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- fail_bad_5891_object_param_qualifiers_by_value.carbon
|
||||
// --- fail_bad_object_param_qualifiers_by_value.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "object_param_qualifiers.h";
|
||||
|
||||
fn Value(v: Cpp.HasQualifiers) {
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: v.plain();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR:
|
||||
v.plain();
|
||||
|
||||
// TODO: This should remain invalid once we support `volatile`.
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: volatile struct HasQualifiers` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: volatile struct HasQualifiers` [SemanticsTodo]
|
||||
// CHECK:STDERR: v.volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: v.volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
v.volatile_this();
|
||||
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: v.ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR:
|
||||
v.ref_this();
|
||||
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: v.ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: v.ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
v.ref_ref_this();
|
||||
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: v.const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: v.const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -180,7 +148,7 @@ struct ExplicitObjectParam {
|
||||
void H(this Another);
|
||||
};
|
||||
|
||||
// --- fail_todo_5891_call_explicit_object_param.carbon
|
||||
// --- call_explicit_object_param.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -188,36 +156,13 @@ import Cpp library "explicit_object_param.h";
|
||||
|
||||
fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: e.F();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
e.F();
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon:[[@LINE+9]]:3: error: member name of type `<type of Cpp.G>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
|
||||
// CHECK:STDERR: n.(Cpp.ExplicitObjectParam.G)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: n.(Cpp.ExplicitObjectParam.G)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
n.(Cpp.ExplicitObjectParam.G)();
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon:[[@LINE+9]]:3: error: member name of type `<type of Cpp.H>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
|
||||
// CHECK:STDERR: a.(Cpp.ExplicitObjectParam.H)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: a.(Cpp.ExplicitObjectParam.H)();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_call_explicit_object_param.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
a.(Cpp.ExplicitObjectParam.H)();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_object_param_qualifiers.carbon
|
||||
// CHECK:STDOUT: --- use_object_param_qualifiers.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
|
||||
@@ -272,46 +217,58 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%v.param: %HasQualifiers, %p.param: %ptr.ec3) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %v.ref.loc13: %HasQualifiers = name_ref v, %v
|
||||
// CHECK:STDOUT: %const_this.ref.loc13: %.602 = name_ref const_this, imports.%.ce8 [concrete = constants.%empty_struct.63b]
|
||||
// CHECK:STDOUT: %addr.loc13: %ptr.ec3 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_16.1: %ptr.2cb = as_compatible %addr.loc13 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc13_16.2: %ptr.2cb = converted %addr.loc13, %.loc13_16.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.call.loc13: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc13_16.2)
|
||||
// CHECK:STDOUT: %v.ref.loc19: %HasQualifiers = name_ref v, %v
|
||||
// CHECK:STDOUT: %const_ref_this.ref.loc19: %.bf0 = name_ref const_ref_this, imports.%.667 [concrete = constants.%empty_struct.4f2]
|
||||
// CHECK:STDOUT: %addr.loc19: %ptr.ec3 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_20.1: %ptr.2cb = as_compatible %addr.loc19 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc19_20.2: %ptr.2cb = converted %addr.loc19, %.loc19_20.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc19: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc19_20.2)
|
||||
// CHECK:STDOUT: %p.ref.loc26: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc26: ref %HasQualifiers = deref %p.ref.loc26
|
||||
// CHECK:STDOUT: %v.ref.loc8: %HasQualifiers = name_ref v, %v
|
||||
// CHECK:STDOUT: %const_this.ref.loc8: %.602 = name_ref const_this, imports.%.ce8 [concrete = constants.%empty_struct.63b]
|
||||
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %v.ref.loc8, %const_this.ref.loc8
|
||||
// CHECK:STDOUT: %.loc8_3: ref %HasQualifiers = value_as_ref %v.ref.loc8
|
||||
// CHECK:STDOUT: %addr.loc8: %ptr.ec3 = addr_of %.loc8_3
|
||||
// CHECK:STDOUT: %.loc8_16.1: %ptr.2cb = as_compatible %addr.loc8
|
||||
// CHECK:STDOUT: %.loc8_16.2: %ptr.2cb = converted %addr.loc8, %.loc8_16.1
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc8_16.2)
|
||||
// CHECK:STDOUT: %v.ref.loc9: %HasQualifiers = name_ref v, %v
|
||||
// CHECK:STDOUT: %const_ref_this.ref.loc9: %.bf0 = name_ref const_ref_this, imports.%.667 [concrete = constants.%empty_struct.4f2]
|
||||
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %v.ref.loc9, %const_ref_this.ref.loc9
|
||||
// CHECK:STDOUT: %.loc9_3: ref %HasQualifiers = value_as_ref %v.ref.loc9
|
||||
// CHECK:STDOUT: %addr.loc9: %ptr.ec3 = addr_of %.loc9_3
|
||||
// CHECK:STDOUT: %.loc9_20.1: %ptr.2cb = as_compatible %addr.loc9
|
||||
// CHECK:STDOUT: %.loc9_20.2: %ptr.2cb = converted %addr.loc9, %.loc9_20.1
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc9_20.2)
|
||||
// CHECK:STDOUT: %p.ref.loc11: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc11: ref %HasQualifiers = deref %p.ref.loc11
|
||||
// CHECK:STDOUT: %plain.ref: %.64b = name_ref plain, imports.%.646 [concrete = constants.%empty_struct.a83]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl(<error>)
|
||||
// CHECK:STDOUT: %p.ref.loc32: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc32: ref %HasQualifiers = deref %p.ref.loc32
|
||||
// CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %.loc11, %plain.ref
|
||||
// CHECK:STDOUT: %addr.loc11: %ptr.ec3 = addr_of %.loc11
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.call: init %empty_tuple.type = call imports.%HasQualifiers.plain.decl(%addr.loc11)
|
||||
// CHECK:STDOUT: %p.ref.loc12: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc12: ref %HasQualifiers = deref %p.ref.loc12
|
||||
// CHECK:STDOUT: %ref_this.ref: %.352 = name_ref ref_this, imports.%.145 [concrete = constants.%empty_struct.f58]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.call: init %empty_tuple.type = call imports.%HasQualifiers.ref_this.decl(<error>)
|
||||
// CHECK:STDOUT: %p.ref.loc38: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc38_4: ref %HasQualifiers = deref %p.ref.loc38
|
||||
// CHECK:STDOUT: %const_this.ref.loc38: %.602 = name_ref const_this, imports.%.ce8 [concrete = constants.%empty_struct.63b]
|
||||
// CHECK:STDOUT: %addr.loc38: %ptr.ec3 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc38_17.1: %ptr.2cb = as_compatible %addr.loc38 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc38_17.2: %ptr.2cb = converted %addr.loc38, %.loc38_17.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.call.loc38: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc38_17.2)
|
||||
// CHECK:STDOUT: %p.ref.loc44: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc44_4: ref %HasQualifiers = deref %p.ref.loc44
|
||||
// CHECK:STDOUT: %const_ref_this.ref.loc44: %.bf0 = name_ref const_ref_this, imports.%.667 [concrete = constants.%empty_struct.4f2]
|
||||
// CHECK:STDOUT: %addr.loc44: %ptr.ec3 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc44_21.1: %ptr.2cb = as_compatible %addr.loc44 [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc44_21.2: %ptr.2cb = converted %addr.loc44, %.loc44_21.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc44: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc44_21.2)
|
||||
// CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %.loc12, %ref_this.ref
|
||||
// CHECK:STDOUT: %addr.loc12: %ptr.ec3 = addr_of %.loc12
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.call: init %empty_tuple.type = call imports.%HasQualifiers.ref_this.decl(%addr.loc12)
|
||||
// CHECK:STDOUT: %p.ref.loc13: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc13_4.1: ref %HasQualifiers = deref %p.ref.loc13
|
||||
// CHECK:STDOUT: %const_this.ref.loc13: %.602 = name_ref const_this, imports.%.ce8 [concrete = constants.%empty_struct.63b]
|
||||
// CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %.loc13_4.1, %const_this.ref.loc13
|
||||
// CHECK:STDOUT: %.loc13_4.2: %HasQualifiers = bind_value %.loc13_4.1
|
||||
// CHECK:STDOUT: %.loc13_4.3: ref %HasQualifiers = value_as_ref %.loc13_4.2
|
||||
// CHECK:STDOUT: %addr.loc13: %ptr.ec3 = addr_of %.loc13_4.3
|
||||
// CHECK:STDOUT: %.loc13_17.1: %ptr.2cb = as_compatible %addr.loc13
|
||||
// CHECK:STDOUT: %.loc13_17.2: %ptr.2cb = converted %addr.loc13, %.loc13_17.1
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.call.loc13: init %empty_tuple.type = call imports.%const_this__carbon_thunk.decl(%.loc13_17.2)
|
||||
// CHECK:STDOUT: %p.ref.loc14: %ptr.ec3 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc14_4.1: ref %HasQualifiers = deref %p.ref.loc14
|
||||
// CHECK:STDOUT: %const_ref_this.ref.loc14: %.bf0 = name_ref const_ref_this, imports.%.667 [concrete = constants.%empty_struct.4f2]
|
||||
// CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %.loc14_4.1, %const_ref_this.ref.loc14
|
||||
// CHECK:STDOUT: %.loc14_4.2: %HasQualifiers = bind_value %.loc14_4.1
|
||||
// CHECK:STDOUT: %.loc14_4.3: ref %HasQualifiers = value_as_ref %.loc14_4.2
|
||||
// CHECK:STDOUT: %addr.loc14: %ptr.ec3 = addr_of %.loc14_4.3
|
||||
// CHECK:STDOUT: %.loc14_21.1: %ptr.2cb = as_compatible %addr.loc14
|
||||
// CHECK:STDOUT: %.loc14_21.2: %ptr.2cb = converted %addr.loc14, %.loc14_21.1
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.call.loc14: init %empty_tuple.type = call imports.%const_ref_this__carbon_thunk.decl(%.loc14_21.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_5891_call_explicit_object_param.carbon
|
||||
// CHECK:STDOUT: --- call_explicit_object_param.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %ExplicitObjectParam: type = class_type @ExplicitObjectParam [concrete]
|
||||
@@ -367,19 +324,24 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %e.ref: %ExplicitObjectParam = name_ref e, %e
|
||||
// CHECK:STDOUT: %F.ref: %.3e2 = name_ref F, imports.%.037 [concrete = constants.%empty_struct.48d]
|
||||
// CHECK:STDOUT: %addr.loc13: %ptr.7f5 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call: init %empty_tuple.type = call imports.%F__carbon_thunk.decl(%addr.loc13)
|
||||
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %e.ref, %F.ref
|
||||
// CHECK:STDOUT: %.loc8: ref %ExplicitObjectParam = value_as_ref %e.ref
|
||||
// CHECK:STDOUT: %addr.loc8: %ptr.7f5 = addr_of %.loc8
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call: init %empty_tuple.type = call imports.%F__carbon_thunk.decl(%addr.loc8)
|
||||
// CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n
|
||||
// CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc23: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc9: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
// CHECK:STDOUT: %G.ref: %.d44 = name_ref G, imports.%.151 [concrete = constants.%empty_struct.a7c]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.call: init %empty_tuple.type = call imports.%ExplicitObjectParam.G.decl(<error>)
|
||||
// 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: %a.ref: %Another = name_ref a, %a
|
||||
// CHECK:STDOUT: %Cpp.ref.loc33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.ref.loc33: type = name_ref ExplicitObjectParam, imports.%ExplicitObjectParam.decl [concrete = constants.%ExplicitObjectParam]
|
||||
// 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]
|
||||
// CHECK:STDOUT: %H.ref: %.9fb = name_ref H, imports.%.34a [concrete = constants.%empty_struct.b14]
|
||||
// CHECK:STDOUT: %addr.loc33: %ptr.289 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %H__carbon_thunk.call: init %empty_tuple.type = call imports.%H__carbon_thunk.decl(%addr.loc33)
|
||||
// CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %a.ref, %H.ref
|
||||
// CHECK:STDOUT: %.loc10: ref %Another = value_as_ref %a.ref
|
||||
// CHECK:STDOUT: %addr.loc10: %ptr.289 = addr_of %.loc10
|
||||
// CHECK:STDOUT: %H__carbon_thunk.call: init %empty_tuple.type = call imports.%H__carbon_thunk.decl(%addr.loc10)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -514,6 +514,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.f68 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc15: ref %Bar = deref %bar.ref
|
||||
// CHECK:STDOUT: %f.ref: %.2e2 = name_ref f, imports.%.6e0 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc15, %f.ref
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+22
-27
@@ -10,8 +10,6 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/template.carbon
|
||||
|
||||
// TODO: Tests marked as `fail_todo_5891_` to fixed as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
|
||||
|
||||
// --- class_template.h
|
||||
|
||||
struct Base {};
|
||||
@@ -24,7 +22,7 @@ template<typename T> struct A : Base {
|
||||
using Aint = A<int>;
|
||||
using Along = A<long>;
|
||||
|
||||
// --- fail_todo_5891_use_class_template.carbon
|
||||
// --- use_class_template.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -33,11 +31,6 @@ import Cpp library "class_template.h";
|
||||
fn F(x: Cpp.Aint) -> i32 {
|
||||
// Trigger instantiation through name lookup.
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_5891_use_class_template.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: x.f();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_use_class_template.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
x.f();
|
||||
return x.n;
|
||||
//@dump-sem-ir-end
|
||||
@@ -87,7 +80,7 @@ var x: Cpp.XY.r#type = 0;
|
||||
var y: Cpp.Xint.r#type = 0;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_class_template.carbon
|
||||
// CHECK:STDOUT: --- use_class_template.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %A.0bedf0.1: type = class_type @A.1 [concrete]
|
||||
@@ -143,36 +136,38 @@ var y: Cpp.Xint.r#type = 0;
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%x.param: %A.0bedf0.1) -> %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %x.ref.loc14: %A.0bedf0.1 = name_ref x, %x
|
||||
// CHECK:STDOUT: %x.ref.loc9: %A.0bedf0.1 = name_ref x, %x
|
||||
// CHECK:STDOUT: %f.ref: %.658 = name_ref f, imports.%.d46 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %addr: %ptr.270828.1 = addr_of <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc14_7.1: %ptr.703 = as_compatible %addr [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc14_7.2: %ptr.703 = converted %addr, %.loc14_7.1 [concrete = <error>]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc14_7.2)
|
||||
// CHECK:STDOUT: %x.ref.loc15: %A.0bedf0.1 = name_ref x, %x
|
||||
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %x.ref.loc9, %f.ref
|
||||
// CHECK:STDOUT: %.loc9_3: ref %A.0bedf0.1 = value_as_ref %x.ref.loc9
|
||||
// CHECK:STDOUT: %addr: %ptr.270828.1 = addr_of %.loc9_3
|
||||
// CHECK:STDOUT: %.loc9_7.1: %ptr.703 = as_compatible %addr
|
||||
// CHECK:STDOUT: %.loc9_7.2: %ptr.703 = converted %addr, %.loc9_7.1
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc9_7.2)
|
||||
// CHECK:STDOUT: %x.ref.loc10: %A.0bedf0.1 = name_ref x, %x
|
||||
// CHECK:STDOUT: %n.ref: %A.elem.c3f = name_ref n, @A.1.%.2 [concrete = @A.1.%.2]
|
||||
// CHECK:STDOUT: %.loc15_11.1: ref %i32 = class_element_access %x.ref.loc15, element1
|
||||
// CHECK:STDOUT: %.loc15_11.2: %i32 = bind_value %.loc15_11.1
|
||||
// CHECK:STDOUT: %.loc10_11.1: ref %i32 = class_element_access %x.ref.loc10, element1
|
||||
// CHECK:STDOUT: %.loc10_11.2: %i32 = bind_value %.loc10_11.1
|
||||
// CHECK:STDOUT: %impl.elem0: %.7fa = impl_witness_access constants.%Copy.impl_witness.a32, element0 [concrete = constants.%Int.as.Copy.impl.Op.f59]
|
||||
// CHECK:STDOUT: %bound_method.loc15_11.1: <bound method> = bound_method %.loc15_11.2, %impl.elem0
|
||||
// CHECK:STDOUT: %bound_method.loc10_11.1: <bound method> = bound_method %.loc10_11.2, %impl.elem0
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc15_11.2: <bound method> = bound_method %.loc15_11.2, %specific_fn
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc15_11.2(%.loc15_11.2)
|
||||
// CHECK:STDOUT: %bound_method.loc10_11.2: <bound method> = bound_method %.loc10_11.2, %specific_fn
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc10_11.2(%.loc10_11.2)
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G(%p.param: %ptr.270828.2) -> %ptr.fb2 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %p.ref: %ptr.270828.2 = name_ref p, %p
|
||||
// CHECK:STDOUT: %.loc22_11.1: ref %A.0bedf0.2 = deref %p.ref
|
||||
// CHECK:STDOUT: %.loc22_11.2: ref %Base = class_element_access %.loc22_11.1, element0
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of %.loc22_11.2
|
||||
// CHECK:STDOUT: %.loc22_11.3: %ptr.fb2 = converted %p.ref, %addr
|
||||
// CHECK:STDOUT: %.loc17_11.1: ref %A.0bedf0.2 = deref %p.ref
|
||||
// CHECK:STDOUT: %.loc17_11.2: ref %Base = class_element_access %.loc17_11.1, element0
|
||||
// CHECK:STDOUT: %addr: %ptr.fb2 = addr_of %.loc17_11.2
|
||||
// CHECK:STDOUT: %.loc17_11.3: %ptr.fb2 = converted %p.ref, %addr
|
||||
// CHECK:STDOUT: %impl.elem0: %.e43 = impl_witness_access constants.%Copy.impl_witness.fe1, element0 [concrete = constants.%ptr.as.Copy.impl.Op.07b]
|
||||
// CHECK:STDOUT: %bound_method.loc22_11.1: <bound method> = bound_method %.loc22_11.3, %impl.elem0
|
||||
// CHECK:STDOUT: %bound_method.loc17_11.1: <bound method> = bound_method %.loc17_11.3, %impl.elem0
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%Base) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc22_11.2: <bound method> = bound_method %.loc22_11.3, %specific_fn
|
||||
// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.fb2 = call %bound_method.loc22_11.2(%.loc22_11.3)
|
||||
// CHECK:STDOUT: %bound_method.loc17_11.2: <bound method> = bound_method %.loc17_11.3, %specific_fn
|
||||
// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.fb2 = call %bound_method.loc17_11.2(%.loc17_11.3)
|
||||
// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+27
-33
@@ -10,8 +10,6 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/enum/anonymous.carbon
|
||||
|
||||
// TODO: Tests marked as `fail_todo_5891_` to fixed as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
|
||||
|
||||
// --- anon.h
|
||||
|
||||
enum { a, b, c };
|
||||
@@ -25,7 +23,7 @@ class C {
|
||||
void F(decltype(d));
|
||||
};
|
||||
|
||||
// --- fail_todo_5891_copy_enum.carbon
|
||||
// --- copy_enum.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -35,16 +33,11 @@ import Cpp library "anon.h";
|
||||
fn G() {
|
||||
Cpp.F(Cpp.b);
|
||||
|
||||
// CHECK:STDERR: fail_todo_5891_copy_enum.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: Cpp.C.C().F(Cpp.C.e);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_5891_copy_enum.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
Cpp.C.C().F(Cpp.C.e);
|
||||
}
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// CHECK:STDOUT: --- fail_todo_5891_copy_enum.carbon
|
||||
// CHECK:STDOUT: --- copy_enum.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
|
||||
@@ -122,33 +115,34 @@ fn G() {
|
||||
// CHECK:STDOUT: %.loc8_12.2: ref %.4f0 = temporary %.loc8_12.1, %b.ref
|
||||
// CHECK:STDOUT: %addr.loc8_14: %ptr.793 = addr_of %.loc8_12.2
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.1(%addr.loc8_14)
|
||||
// CHECK:STDOUT: %Cpp.ref.loc15_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc15_6: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc15_8: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct.e73]
|
||||
// CHECK:STDOUT: %.loc15_11.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %addr.loc15_11.1: %ptr.d9e = addr_of %.loc15_11.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc15_11.1)
|
||||
// CHECK:STDOUT: %.loc15_11.2: init %C = in_place_init %C__carbon_thunk.call, %.loc15_11.1
|
||||
// CHECK:STDOUT: %.loc15_11.3: ref %C = temporary %.loc15_11.1, %.loc15_11.2
|
||||
// CHECK:STDOUT: %F.ref.loc15: %.9a3 = name_ref F, imports.%.951 [concrete = constants.%empty_struct.acc]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc15_15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc15_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc10_6: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc10_8: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct.e73]
|
||||
// CHECK:STDOUT: %.loc10_11.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %addr.loc10_11.1: %ptr.d9e = addr_of %.loc10_11.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc10_11.1)
|
||||
// CHECK:STDOUT: %.loc10_11.2: init %C = in_place_init %C__carbon_thunk.call, %.loc10_11.1
|
||||
// CHECK:STDOUT: %.loc10_11.3: ref %C = temporary %.loc10_11.1, %.loc10_11.2
|
||||
// CHECK:STDOUT: %F.ref.loc10: %.9a3 = name_ref F, imports.%.951 [concrete = constants.%empty_struct.acc]
|
||||
// CHECK:STDOUT: %bound_method.loc10_12: <bound method> = bound_method %.loc10_11.3, %F.ref.loc10
|
||||
// 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: %addr.loc10_11.2: %ptr.d9e = addr_of %.loc10_11.3
|
||||
// CHECK:STDOUT: %.loc10_20.1: ref %.bb7 = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_20.2: ref %.bb7 = temporary %.loc10_20.1, %e.ref
|
||||
// CHECK:STDOUT: %addr.loc10_22: %ptr.73d = addr_of %.loc10_20.2
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc10: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.2(%addr.loc10_11.2, %addr.loc10_22)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc10_20: <bound method> = bound_method %.loc10_20.2, constants.%T.as.Destroy.impl.Op.bd3
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %.loc15_20.1: ref %.bb7 = temporary_storage
|
||||
// CHECK:STDOUT: %.loc15_20.2: ref %.bb7 = temporary %.loc15_20.1, %e.ref
|
||||
// CHECK:STDOUT: %addr.loc15_22: %ptr.73d = addr_of %.loc15_20.2
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc15: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.e1b8ec.2(<error>, %addr.loc15_22)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc15_20: <bound method> = bound_method %.loc15_20.2, constants.%T.as.Destroy.impl.Op.bd3
|
||||
// CHECK:STDOUT: %bound_method.loc10_20: <bound method> = bound_method %.loc10_20.2, %T.as.Destroy.impl.Op.specific_fn.1
|
||||
// CHECK:STDOUT: %addr.loc10_20: %ptr.73d = addr_of %.loc10_20.2
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc10_20: init %empty_tuple.type = call %bound_method.loc10_20(%addr.loc10_20)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc10_11: <bound method> = bound_method %.loc10_11.3, constants.%T.as.Destroy.impl.Op.a28
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %bound_method.loc15_20: <bound method> = bound_method %.loc15_20.2, %T.as.Destroy.impl.Op.specific_fn.1
|
||||
// CHECK:STDOUT: %addr.loc15_20: %ptr.73d = addr_of %.loc15_20.2
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc15_20: init %empty_tuple.type = call %bound_method.loc15_20(%addr.loc15_20)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc15_11: <bound method> = bound_method %.loc15_11.3, constants.%T.as.Destroy.impl.Op.a28
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %bound_method.loc15_11: <bound method> = bound_method %.loc15_11.3, %T.as.Destroy.impl.Op.specific_fn.2
|
||||
// CHECK:STDOUT: %addr.loc15_11.2: %ptr.d9e = addr_of %.loc15_11.3
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc15_11: init %empty_tuple.type = call %bound_method.loc15_11(%addr.loc15_11.2)
|
||||
// CHECK:STDOUT: %bound_method.loc10_11: <bound method> = bound_method %.loc10_11.3, %T.as.Destroy.impl.Op.specific_fn.2
|
||||
// CHECK:STDOUT: %addr.loc10_11.3: %ptr.d9e = addr_of %.loc10_11.3
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc10_11: init %empty_tuple.type = call %bound_method.loc10_11(%addr.loc10_11.3)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_12.2, constants.%T.as.Destroy.impl.Op.dda
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_12.2, %T.as.Destroy.impl.Op.specific_fn.3
|
||||
|
||||
Reference in New Issue
Block a user