mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 07:34:45 +01:00
[Carbon/C++ interop] Add support for C++ overloaded functions (#5891)
As proposed in [Carbon: C++ interop for overloaded functions and function templates](https://docs.google.com/document/d/1KUxumZtNe3mY3TsjW2s_ZADOlAaFlrtsLKHVILtqIaM/edit?tab=t.0), Clang is used to perform the overload resolution using C++ rules, when an overloaded C++ set is called from Carbon. Once a function is selected, it's converted into a Carbon function and called using the Carbon rules including argument conversions. A single non-templated function is treated the same way as an overload set and the same rules apply for its call. Template functions are not supported yet. Demo: a) Non-templated function calls: ```c++ // --- overloads.h auto foo(int a, short b) -> void; auto foo(double a) -> void; auto foo(int a) -> void; ``` ```c++ // overloads.cpp #include "overloads.h" #include <cstdio> auto foo(int a, short b) -> void { printf("hello from foo_int_short(%d, %d) \n", a, b); } auto foo(double a) -> void { printf("hello from foo_double(%f) \n", a); } auto foo(int a) -> void { printf("hello from foo_int(%d) \n", a); } ``` ```c++ library "Main"; import Cpp library "overloads.h"; fn Run() -> i32 { Cpp.foo(1.1 as f64); return 0; } ``` ``` $ clang -c overloads.cpp $ bazel-bin/toolchain/carbon compile main.carbon $ bazel-bin/toolchain/carbon link overloads.o main.o --output=demo $ ./demo hello from foo_double(1.100000) ``` b) Constructors: ```c++ // --- constructor_overloads.h class C { public: C(); C(int a, int b); }; ``` ```c++ // constructor_overloads.cpp #include "constructor_overloads.h" #include <cstdio> C::C() { printf("hello from C() \n"); } C::C(int a, int b) { printf("hello from C(%d, %d) \n", a, b); } ``` ```c++ library "Main"; import Cpp library "constructor_overloads.h"; fn Run() -> i32 { let c1: Cpp.C = Cpp.C.C(); let c2: Cpp.C = Cpp.C.C(1, 2); return 0; } ``` ``` $ clang -c constructor_overloads.cpp $ bazel-bin/toolchain/carbon compile main.carbon $ bazel-bin/toolchain/carbon link constructor_overloads.o main.o \--output=demo $ ./demo hello from C() hello from C(1, 2) ``` Follow-ups: - `Cpp.foo({})` - proper handling of struct literals as call args. - Fix access for overloaded sets. - Fix tests: - Method calls: `error: missing object argument in method call [MissingObjectInMethodCall]` in tests. - Fix `toolchain/check/testdata/interop/cpp/import.carbon` test. - Fix `enums` support. - Fix `str` -> `std::string_view` mapping. Part of #5915
This commit is contained in:
+31
-19
@@ -10,6 +10,8 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/class/access.carbon
|
||||
|
||||
// TODO: Tests marked as `fail_todo_5891_` to fixed as a follow-up of https://github.com/carbon-language/carbon-lang/pull/5891.
|
||||
|
||||
// ============================================================================
|
||||
// Public non-function member
|
||||
// ============================================================================
|
||||
@@ -159,7 +161,7 @@ struct S {
|
||||
auto foo() -> void;
|
||||
};
|
||||
|
||||
// --- import_function_member_public.carbon
|
||||
// --- fail_todo_5891_import_function_member_public.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -167,6 +169,11 @@ 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
|
||||
}
|
||||
@@ -238,7 +245,7 @@ class C {
|
||||
static auto foo(int a, int b) -> void;
|
||||
};
|
||||
|
||||
// --- fail_todo_import_overload_set_public.carbon
|
||||
// --- fail_todo_5891_import_overload_set_public.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -246,10 +253,10 @@ import Cpp library "overload_set.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_public.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Lookup succeeded but couldn't find a single result; LookupResultKind: 3` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_public.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Overloaded set with mixed access` [SemanticsTodo]
|
||||
// CHECK:STDERR: Cpp.C.foo();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_public.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_public.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: Cpp.C.foo();
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -257,34 +264,34 @@ fn F() {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- fail_todo_import_overload_set_protected.carbon
|
||||
// --- fail_todo_5891_import_overload_set_protected.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "overload_set.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_protected.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Lookup succeeded but couldn't find a single result; LookupResultKind: 3` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_protected.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Overloaded set with mixed access` [SemanticsTodo]
|
||||
// CHECK:STDERR: Cpp.C.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_protected.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_protected.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: Cpp.C.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.C.foo(1 as i32);
|
||||
}
|
||||
|
||||
// --- fail_todo_import_overload_set_private.carbon
|
||||
// --- fail_todo_5891_import_overload_set_private.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "overload_set.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_private.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Lookup succeeded but couldn't find a single result; LookupResultKind: 3` [SemanticsTodo]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_private.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Overloaded set with mixed access` [SemanticsTodo]
|
||||
// CHECK:STDERR: Cpp.C.foo(1 as i32, 2 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_import_overload_set_private.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: fail_todo_5891_import_overload_set_private.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
|
||||
// CHECK:STDERR: Cpp.C.foo(1 as i32, 2 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -425,17 +432,20 @@ fn F() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- import_function_member_public.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_import_function_member_public.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %S: type = class_type @S [concrete]
|
||||
// CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %.177: type = cpp_overload_set_type @S.foo [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.177 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %S.foo.type: type = fn_type @S.foo [concrete]
|
||||
// CHECK:STDOUT: %S.foo: %S.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %.dcb: %.177 = cpp_overload_set_value @S.foo [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %S.foo.decl: %S.foo.type = fn_decl @S.foo [concrete = constants.%S.foo] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -446,15 +456,14 @@ 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: %.loc8: ref %S = deref %s.ref
|
||||
// CHECK:STDOUT: %foo.ref: %S.foo.type = name_ref foo, imports.%S.foo.decl [concrete = constants.%S.foo]
|
||||
// CHECK:STDOUT: %S.foo.bound: <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 %S.foo.bound(%addr)
|
||||
// CHECK:STDOUT: %.loc13: 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: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_import_overload_set_public.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_import_overload_set_public.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
@@ -481,6 +490,8 @@ fn F() {
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %DerivedPublic: type = class_type @DerivedPublic [concrete]
|
||||
// CHECK:STDOUT: %.5a6: type = cpp_overload_set_type @Base.foo [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.5a6 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Base.foo.type: type = fn_type @Base.foo [concrete]
|
||||
// CHECK:STDOUT: %Base.foo: %Base.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -491,6 +502,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %DerivedPublic.decl: type = class_decl @DerivedPublic [concrete = constants.%DerivedPublic] {} {}
|
||||
// CHECK:STDOUT: %.607: %.5a6 = cpp_overload_set_value @Base.foo [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Base.foo.decl: %Base.foo.type = fn_decl @Base.foo [concrete = constants.%Base.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -498,8 +510,8 @@ fn F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %DerivedPublic.ref: type = name_ref DerivedPublic, imports.%DerivedPublic.decl [concrete = constants.%DerivedPublic]
|
||||
// CHECK:STDOUT: %foo.ref: %Base.foo.type = name_ref foo, imports.%Base.foo.decl [concrete = constants.%Base.foo]
|
||||
// CHECK:STDOUT: %Base.foo.call: init %empty_tuple.type = call %foo.ref()
|
||||
// CHECK:STDOUT: %foo.ref: %.5a6 = name_ref foo, imports.%.607 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Base.foo.call: init %empty_tuple.type = call imports.%Base.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+50
-43
@@ -10,6 +10,8 @@
|
||||
// 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 {};
|
||||
@@ -101,7 +103,7 @@ struct Derived : Base {
|
||||
void g() const;
|
||||
};
|
||||
|
||||
// --- use_base_method.carbon
|
||||
// --- fail_todo_5891_use_base_method.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -109,12 +111,26 @@ 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
|
||||
}
|
||||
@@ -344,9 +360,15 @@ class V {
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %.75e: type = cpp_overload_set_type @<null name> [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.c9f: %.75e = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Base.base_fn.type: type = fn_type @Base.base_fn [concrete]
|
||||
// CHECK:STDOUT: %Base.base_fn: %Base.base_fn.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
// CHECK:STDOUT: %.809: type = cpp_overload_set_type @<null name> [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.422: %.809 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.5f9: type = cpp_overload_set_type @<null name> [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.510: %.5f9 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.type: type = fn_type @Derived.derived_fn [concrete]
|
||||
// CHECK:STDOUT: %Derived.derived_fn: %Derived.derived_fn.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -358,8 +380,11 @@ class V {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
|
||||
// CHECK:STDOUT: %.750: %.75e = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.c9f]
|
||||
// CHECK:STDOUT: %Base.base_fn.decl: %Base.base_fn.type = fn_decl @Base.base_fn [concrete = constants.%Base.base_fn] {} {}
|
||||
// CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
|
||||
// CHECK:STDOUT: %.22a: %.809 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.422]
|
||||
// CHECK:STDOUT: %.24a: %.5f9 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.510]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.decl: %Derived.derived_fn.type = fn_decl @Derived.derived_fn [concrete = constants.%Derived.derived_fn] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -367,16 +392,16 @@ class V {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8: <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: %base_fn.ref.loc8: %Base.base_fn.type = name_ref base_fn, imports.%Base.base_fn.decl [concrete = constants.%Base.base_fn]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc8: init %empty_tuple.type = call %base_fn.ref.loc8()
|
||||
// CHECK:STDOUT: %base_fn.ref.loc8: %.75e = name_ref base_fn, imports.%.750 [concrete = constants.%empty_struct.c9f]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc8: init %empty_tuple.type = call imports.%Base.base_fn.decl()
|
||||
// CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Derived.ref.loc9: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %base_fn.ref.loc9: %Base.base_fn.type = name_ref base_fn, imports.%Base.base_fn.decl [concrete = constants.%Base.base_fn]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc9: init %empty_tuple.type = call %base_fn.ref.loc9()
|
||||
// CHECK:STDOUT: %base_fn.ref.loc9: %.809 = name_ref base_fn, imports.%.22a [concrete = constants.%empty_struct.422]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc9: init %empty_tuple.type = call imports.%Base.base_fn.decl()
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Derived.ref.loc10: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %derived_fn.ref: %Derived.derived_fn.type = name_ref derived_fn, imports.%Derived.derived_fn.decl [concrete = constants.%Derived.derived_fn]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.call: init %empty_tuple.type = call %derived_fn.ref()
|
||||
// CHECK:STDOUT: %derived_fn.ref: %.5f9 = name_ref derived_fn, imports.%.24a [concrete = constants.%empty_struct.510]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.call: init %empty_tuple.type = call imports.%Derived.derived_fn.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -447,21 +472,21 @@ class V {
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- use_base_method.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_base_method.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %Base.f.type: type = fn_type @Base.f [concrete]
|
||||
// CHECK:STDOUT: %Base.f: %Base.f.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.5b0: type = cpp_overload_set_type @f__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.3f3: %.5b0 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %const: type = const_type %Base [concrete]
|
||||
// CHECK:STDOUT: %ptr.a97: type = ptr_type %const [concrete]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.type: type = fn_type @f__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %f__carbon_thunk: %f__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.fb2: type = ptr_type %Base [concrete]
|
||||
// CHECK:STDOUT: %Base.g.type: type = fn_type @Base.g [concrete]
|
||||
// CHECK:STDOUT: %Base.g: %Base.g.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.7c6: type = cpp_overload_set_type @CallQualified [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.49e: %.7c6 = 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: }
|
||||
@@ -474,21 +499,13 @@ class V {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
|
||||
// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
|
||||
// CHECK:STDOUT: %Base.f.decl: %Base.f.type = fn_decl @Base.f [concrete = constants.%Base.f] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.e54: %.5b0 = cpp_overload_set_value @f__carbon_thunk [concrete = constants.%empty_struct.3f3]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.decl: %f__carbon_thunk.type = fn_decl @f__carbon_thunk [concrete = constants.%f__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Base.g.decl: %Base.g.type = fn_decl @Base.g [concrete = constants.%Base.g] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.362: %.7c6 = cpp_overload_set_value @CallQualified [concrete = constants.%empty_struct.49e]
|
||||
// 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: } {
|
||||
@@ -499,34 +516,24 @@ class V {
|
||||
// CHECK:STDOUT: fn @CallDirect(%d.param: %Derived) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %f.ref: %Base.f.type = name_ref f, imports.%Base.f.decl [concrete = constants.%Base.f]
|
||||
// CHECK:STDOUT: %Base.f.bound: <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: %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: <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.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc28: <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: %Base.g.type = name_ref g, imports.%Base.g.decl [concrete = constants.%Base.g]
|
||||
// CHECK:STDOUT: %Base.g.bound: <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: %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: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+10
-4
@@ -337,6 +337,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %.c07: type = cpp_overload_set_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.c07 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -347,6 +349,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %.617: %.c07 = cpp_overload_set_value @Bar.foo [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -354,8 +357,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.foo.type = name_ref foo, imports.%Bar.foo.decl [concrete = constants.%Bar.foo]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call %foo.ref()
|
||||
// CHECK:STDOUT: %foo.ref: %.c07 = name_ref foo, imports.%.617 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -500,6 +503,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: %complete_type.fff: <witness> = complete_type_witness %struct_type.base.36d [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.c07: type = cpp_overload_set_type @Derived.as.Destroy.impl.Op [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.c07 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -510,6 +515,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %.617: %.c07 = cpp_overload_set_value @Derived.as.Destroy.impl.Op [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -558,8 +564,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.foo.type = name_ref foo, imports.%Bar.foo.decl [concrete = constants.%Bar.foo]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call %foo.ref()
|
||||
// CHECK:STDOUT: %foo.ref: %.c07 = name_ref foo, imports.%.617 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+131
-83
@@ -68,7 +68,7 @@ class C {
|
||||
C(int x, int y);
|
||||
};
|
||||
|
||||
// --- fail_todo_import_multiple.carbon
|
||||
// --- import_multiple.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -76,13 +76,6 @@ import Cpp library "multiple.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_import_multiple.carbon:[[@LINE+7]]:19: error: semantics TODO: `Unsupported: Constructors lookup succeeded but couldn't find a single result; Found 2 constructors` [SemanticsTodo]
|
||||
// CHECK:STDERR: let c1: Cpp.C = Cpp.C.C();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_todo_import_multiple.carbon:[[@LINE+4]]:19: note: in `Cpp` name lookup for `C` [InCppNameLookup]
|
||||
// CHECK:STDERR: let c1: Cpp.C = Cpp.C.C();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let c1: Cpp.C = Cpp.C.C();
|
||||
let c2: Cpp.C = Cpp.C.C(123, 456);
|
||||
//@dump-sem-ir-end
|
||||
@@ -135,10 +128,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "none.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_none.carbon:[[@LINE+7]]:18: error: semantics TODO: `Unsupported: Constructors lookup succeeded but couldn't find a single result; Found 0 constructors` [SemanticsTodo]
|
||||
// CHECK:STDERR: let c: Cpp.C = Cpp.C.C();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_import_none.carbon:[[@LINE+4]]:18: note: in `Cpp` name lookup for `C` [InCppNameLookup]
|
||||
// CHECK:STDERR: fail_import_none.carbon:[[@LINE+4]]:18: error: member name `C` not found in `Cpp.C` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: let c: Cpp.C = Cpp.C.C();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -219,8 +209,8 @@ fn F() {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %C.C.type: type = fn_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %C.C: %C.C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
|
||||
@@ -234,11 +224,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C.C.decl: %C.C.type = fn_decl @C.C [concrete = constants.%C.C] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -253,7 +239,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_23: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_23: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc8_26.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %addr.loc8_26.1: %ptr.d9e = addr_of %.loc8_26.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8_26.1)
|
||||
@@ -279,15 +265,15 @@ fn F() {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_123.fff: Core.IntLiteral = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %int_456.010: Core.IntLiteral = int_value 456 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C.C.type: type = fn_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %C.C: %C.C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_123.fff: Core.IntLiteral = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %int_456.010: Core.IntLiteral = int_value 456 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
@@ -315,11 +301,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C.C.decl: %C.C.type = fn_decl @C.C [concrete = constants.%C.C] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -336,7 +318,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_23: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_23: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123.fff]
|
||||
// CHECK:STDOUT: %int_456: Core.IntLiteral = int_value 456 [concrete = constants.%int_456.010]
|
||||
// CHECK:STDOUT: %.loc8_34.1: ref %C = temporary_storage
|
||||
@@ -372,13 +354,42 @@ fn F() {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_import_multiple.carbon
|
||||
// CHECK:STDOUT: --- import_multiple.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %int_456: Core.IntLiteral = int_value 456 [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C.1 [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type.65f120.1: type = fn_type @C__carbon_thunk.1 [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.d98342.1: %C__carbon_thunk.type.65f120.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_123.fff: Core.IntLiteral = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %int_456.010: Core.IntLiteral = int_value 456 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type.65f120.2: type = fn_type @C__carbon_thunk.2 [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.d98342.2: %C__carbon_thunk.type.65f120.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.f01: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness.acc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.b6b, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9ec: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.592: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.9ec = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.acc) [concrete]
|
||||
// CHECK:STDOUT: %.7ea: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.88d: <bound method> = bound_method %int_123.fff, %Core.IntLiteral.as.ImplicitAs.impl.Convert.592 [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.592, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %bound_method.6ab: <bound method> = bound_method %int_123.fff, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
||||
// CHECK:STDOUT: %int_123.f7f: %i32 = int_value 123 [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f2: <bound method> = bound_method %int_456.010, %Core.IntLiteral.as.ImplicitAs.impl.Convert.592 [concrete]
|
||||
// CHECK:STDOUT: %bound_method.098: <bound method> = bound_method %int_456.010, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
|
||||
// CHECK:STDOUT: %int_456.d17: %i32 = int_value 456 [concrete]
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.type.140: type = fn_type @T.as.Destroy.impl.Op, @T.as.Destroy.impl(%C) [concrete]
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.d4e: %T.as.Destroy.impl.Op.type.140 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -387,34 +398,83 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C.1 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl.8acdfe.1: %C__carbon_thunk.type.65f120.1 = fn_decl @C__carbon_thunk.1 [concrete = constants.%C__carbon_thunk.d98342.1] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl.8acdfe.2: %C__carbon_thunk.type.65f120.2 = fn_decl @C__carbon_thunk.2 [concrete = constants.%C__carbon_thunk.d98342.2] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.import_ref.428: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.49e) = import_ref Core//prelude/parts/int, loc23_39, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f01)]
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.b6b = impl_witness_table (%Core.import_ref.428), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c1.patt: %pattern_type = binding_pattern c1 [concrete]
|
||||
// CHECK:STDOUT: %c1.patt: %pattern_type.217 = binding_pattern c1 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc15_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc15_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc15_24: <error> = name_ref C, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc15: type = splice_block %C.ref.loc15_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc15_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc15_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %.loc8_27.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %addr.loc8_27.1: %ptr.d9e = addr_of %.loc8_27.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl.8acdfe.1(%addr.loc8_27.1)
|
||||
// CHECK:STDOUT: %.loc8_27.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_27.1
|
||||
// CHECK:STDOUT: %.loc8_14: type = splice_block %C.ref.loc8_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %c1: %C = bind_name c1, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc8_27.3: ref %C = temporary %.loc8_27.1, %.loc8_27.2
|
||||
// CHECK:STDOUT: %.loc8_27.4: %C = bind_value %.loc8_27.3
|
||||
// CHECK:STDOUT: %c1: %C = bind_name c1, %.loc8_27.4
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c2.patt: %pattern_type = binding_pattern c2 [concrete]
|
||||
// CHECK:STDOUT: %c2.patt: %pattern_type.217 = binding_pattern c2 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc16_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc16_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc16_24: <error> = name_ref C, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123]
|
||||
// CHECK:STDOUT: %int_456: Core.IntLiteral = int_value 456 [concrete = constants.%int_456]
|
||||
// CHECK:STDOUT: %.loc16: type = splice_block %C.ref.loc16_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc16_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc16_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc9_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc9_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc9_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_123: Core.IntLiteral = int_value 123 [concrete = constants.%int_123.fff]
|
||||
// CHECK:STDOUT: %int_456: Core.IntLiteral = int_value 456 [concrete = constants.%int_456.010]
|
||||
// CHECK:STDOUT: %.loc9_35.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_27: %.7ea = impl_witness_access constants.%ImplicitAs.impl_witness.acc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.592]
|
||||
// CHECK:STDOUT: %bound_method.loc9_27.1: <bound method> = bound_method %int_123, %impl.elem0.loc9_27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.88d]
|
||||
// CHECK:STDOUT: %specific_fn.loc9_27: <specific function> = specific_function %impl.elem0.loc9_27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_27.2: <bound method> = bound_method %int_123, %specific_fn.loc9_27 [concrete = constants.%bound_method.6ab]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_27: init %i32 = call %bound_method.loc9_27.2(%int_123) [concrete = constants.%int_123.f7f]
|
||||
// CHECK:STDOUT: %.loc9_27.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_27 [concrete = constants.%int_123.f7f]
|
||||
// CHECK:STDOUT: %.loc9_27.2: %i32 = converted %int_123, %.loc9_27.1 [concrete = constants.%int_123.f7f]
|
||||
// CHECK:STDOUT: %impl.elem0.loc9_32: %.7ea = impl_witness_access constants.%ImplicitAs.impl_witness.acc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.592]
|
||||
// CHECK:STDOUT: %bound_method.loc9_32.1: <bound method> = bound_method %int_456, %impl.elem0.loc9_32 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5f2]
|
||||
// CHECK:STDOUT: %specific_fn.loc9_32: <specific function> = specific_function %impl.elem0.loc9_32, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_32.2: <bound method> = bound_method %int_456, %specific_fn.loc9_32 [concrete = constants.%bound_method.098]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_32: init %i32 = call %bound_method.loc9_32.2(%int_456) [concrete = constants.%int_456.d17]
|
||||
// CHECK:STDOUT: %.loc9_32.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9_32 [concrete = constants.%int_456.d17]
|
||||
// CHECK:STDOUT: %.loc9_32.2: %i32 = converted %int_456, %.loc9_32.1 [concrete = constants.%int_456.d17]
|
||||
// CHECK:STDOUT: %addr.loc9_35.1: %ptr.d9e = addr_of %.loc9_35.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl.8acdfe.2(%.loc9_27.2, %.loc9_32.2, %addr.loc9_35.1)
|
||||
// CHECK:STDOUT: %.loc9_35.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_35.1
|
||||
// CHECK:STDOUT: %.loc9_14: type = splice_block %C.ref.loc9_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc9_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %c2: %C = bind_name c2, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.loc9_35.3: ref %C = temporary %.loc9_35.1, %.loc9_35.2
|
||||
// CHECK:STDOUT: %.loc9_35.4: %C = bind_value %.loc9_35.3
|
||||
// CHECK:STDOUT: %c2: %C = bind_name c2, %.loc9_35.4
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_35.3, constants.%T.as.Destroy.impl.Op.d4e
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %bound_method.loc9_35: <bound method> = bound_method %.loc9_35.3, %T.as.Destroy.impl.Op.specific_fn.1
|
||||
// CHECK:STDOUT: %addr.loc9_35.2: %ptr.d9e = addr_of %.loc9_35.3
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9_35(%addr.loc9_35.2)
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_27.3, constants.%T.as.Destroy.impl.Op.d4e
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_27.3, %T.as.Destroy.impl.Op.specific_fn.2
|
||||
// CHECK:STDOUT: %addr.loc8_27.2: %ptr.d9e = addr_of %.loc8_27.3
|
||||
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%addr.loc8_27.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -424,15 +484,15 @@ fn F() {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %int_9.988: Core.IntLiteral = int_value 9 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C.C.type: type = fn_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %C.C: %C.C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %int_9.988: Core.IntLiteral = int_value 9 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
@@ -460,11 +520,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C.C.decl: %C.C.type = fn_decl @C.C [concrete = constants.%C.C] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -481,7 +537,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_8.loc8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
|
||||
// CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9.988]
|
||||
// CHECK:STDOUT: %.loc8_31.1: ref %C = temporary_storage
|
||||
@@ -514,7 +570,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc14_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc14_24: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc14_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_8.loc14: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
|
||||
// CHECK:STDOUT: %.loc14: type = splice_block %C.ref.loc14_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
@@ -535,14 +591,14 @@ fn F() {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C.C.type: type = fn_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %C.C: %C.C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
@@ -579,11 +635,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C.C.decl: %C.C.type = fn_decl @C.C [concrete = constants.%C.C] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -602,7 +654,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_8.loc8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
|
||||
// CHECK:STDOUT: %.loc8_28.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %impl.elem0.loc8: %.7ea = impl_witness_access constants.%ImplicitAs.impl_witness.acc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.592]
|
||||
@@ -655,15 +707,15 @@ fn F() {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %.d40: type = cpp_overload_set_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.d40 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %int_9.988: Core.IntLiteral = int_value 9 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C.C.type: type = fn_type @C.C [concrete]
|
||||
// CHECK:STDOUT: %C.C: %C.C.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_8.b85: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: %int_9.988: Core.IntLiteral = int_value 9 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
|
||||
@@ -703,11 +755,7 @@ fn F() {
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C.C.decl: %C.C.type = fn_decl @C.C [concrete = constants.%C.C] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.40b: %.d40 = cpp_overload_set_value @C.C [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -726,7 +774,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc8_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_8.loc8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
|
||||
// CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9.988]
|
||||
// CHECK:STDOUT: %.loc8_31.1: ref %C = temporary_storage
|
||||
@@ -759,7 +807,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref.loc14_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %C.ref.loc14_24: %C.C.type = name_ref C, imports.%C.C.decl [concrete = constants.%C.C]
|
||||
// CHECK:STDOUT: %C.ref.loc14_24: %.d40 = name_ref C, imports.%.40b [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %int_8.loc14: Core.IntLiteral = int_value 8 [concrete = constants.%int_8.b85]
|
||||
// CHECK:STDOUT: %.loc14: type = splice_block %C.ref.loc14_14 [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
|
||||
+156
-125
@@ -11,6 +11,8 @@
|
||||
// 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 {
|
||||
@@ -25,7 +27,7 @@ struct HasQualifiers {
|
||||
void const_ref_ref_this() const&&;
|
||||
};
|
||||
|
||||
// --- use_object_param_qualifiers.carbon
|
||||
// --- fail_todo_5891_use_object_param_qualifiers.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -33,62 +35,92 @@ 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_object_param_qualifiers_by_value.carbon
|
||||
// --- fail_bad_5891_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_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: `addr self` method cannot be invoked on a value [AddrSelfIsNonRef]
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: v.plain();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
v.plain();
|
||||
|
||||
// TODO: This should remain invalid once we support `volatile`.
|
||||
// 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: 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: v.volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
|
||||
// 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: v.volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
v.volatile_this();
|
||||
|
||||
// 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: fail_bad_5891_object_param_qualifiers_by_value.carbon:[[@LINE+5]]:3: error: missing object argument in method call [MissingObjectInMethodCall]
|
||||
// CHECK:STDERR: v.ref_this();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_5891_object_param_qualifiers_by_value.carbon: note: calling function declared here [InCallToFunction]
|
||||
// CHECK:STDERR:
|
||||
v.ref_this();
|
||||
|
||||
// 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: fail_bad_5891_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_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
|
||||
// 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: v.ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
v.ref_ref_this();
|
||||
|
||||
// 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: 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: v.const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
|
||||
// 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: v.const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
v.const_ref_ref_this();
|
||||
}
|
||||
@@ -103,10 +135,10 @@ fn Ref(p: Cpp.HasQualifiers*) {
|
||||
// TODO: This should eventually be accepted if we support `volatile`.
|
||||
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: volatile struct HasQualifiers` [SemanticsTodo]
|
||||
// CHECK:STDERR: p->volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `volatile_this` [InCppNameLookup]
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: p->volatile_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
p->volatile_this();
|
||||
}
|
||||
@@ -120,19 +152,19 @@ import Cpp library "object_param_qualifiers.h";
|
||||
fn Ref(p: Cpp.HasQualifiers*) {
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: p->ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `ref_ref_this` [InCppNameLookup]
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: p->ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
p->ref_ref_this();
|
||||
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: object parameter type: const struct HasQualifiers &&` [SemanticsTodo]
|
||||
// CHECK:STDERR: p->const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `const_ref_ref_this` [InCppNameLookup]
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: p->const_ref_ref_this();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
p->const_ref_ref_this();
|
||||
}
|
||||
@@ -148,7 +180,7 @@ struct ExplicitObjectParam {
|
||||
void H(this Another);
|
||||
};
|
||||
|
||||
// --- call_explicit_object_param.carbon
|
||||
// --- fail_todo_5891_call_explicit_object_param.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -156,60 +188,81 @@ 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: --- use_object_param_qualifiers.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_object_param_qualifiers.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %HasQualifiers: type = class_type @HasQualifiers [concrete]
|
||||
// CHECK:STDOUT: %ptr.ec3: type = ptr_type %HasQualifiers [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_this.type: type = fn_type @HasQualifiers.const_this [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_this: %HasQualifiers.const_this.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.602: type = cpp_overload_set_type @const_ref_this__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.63b: %.602 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %const: type = const_type %HasQualifiers [concrete]
|
||||
// CHECK:STDOUT: %ptr.2cb: type = ptr_type %const [concrete]
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.type: type = fn_type @const_this__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk: %const_this__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_ref_this.type: type = fn_type @HasQualifiers.const_ref_this [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_ref_this: %HasQualifiers.const_ref_this.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.bf0: type = cpp_overload_set_type @HasQualifiers.plain [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.4f2: %.bf0 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.type: type = fn_type @const_ref_this__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk: %const_ref_this__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.64b: type = cpp_overload_set_type @HasQualifiers.ref_this [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.a83: %.64b = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.type: type = fn_type @HasQualifiers.plain [concrete]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain: %HasQualifiers.plain.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.352: type = cpp_overload_set_type @<null name> [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.f58: %.352 = struct_value () [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: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %HasQualifiers.const_this.decl: %HasQualifiers.const_this.type = fn_decl @HasQualifiers.const_this [concrete = constants.%HasQualifiers.const_this] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.ce8: %.602 = cpp_overload_set_value @const_ref_this__carbon_thunk [concrete = constants.%empty_struct.63b]
|
||||
// CHECK:STDOUT: %const_this__carbon_thunk.decl: %const_this__carbon_thunk.type = fn_decl @const_this__carbon_thunk [concrete = constants.%const_this__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %HasQualifiers.const_ref_this.decl: %HasQualifiers.const_ref_this.type = fn_decl @HasQualifiers.const_ref_this [concrete = constants.%HasQualifiers.const_ref_this] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.667: %.bf0 = cpp_overload_set_value @HasQualifiers.plain [concrete = constants.%empty_struct.4f2]
|
||||
// CHECK:STDOUT: %const_ref_this__carbon_thunk.decl: %const_ref_this__carbon_thunk.type = fn_decl @const_ref_this__carbon_thunk [concrete = constants.%const_ref_this__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.646: %.64b = cpp_overload_set_value @HasQualifiers.ref_this [concrete = constants.%empty_struct.a83]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.decl: %HasQualifiers.plain.type = fn_decl @HasQualifiers.plain [concrete = constants.%HasQualifiers.plain] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.145: %.352 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.f58]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.decl: %HasQualifiers.ref_this.type = fn_decl @HasQualifiers.ref_this [concrete = constants.%HasQualifiers.ref_this] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -219,58 +272,46 @@ 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.loc8: %HasQualifiers = name_ref v, %v
|
||||
// CHECK:STDOUT: %const_this.ref.loc8: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_this.bound.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: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.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: %HasQualifiers.plain.type = name_ref plain, imports.%HasQualifiers.plain.decl [concrete = constants.%HasQualifiers.plain]
|
||||
// CHECK:STDOUT: %HasQualifiers.plain.bound: <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 %HasQualifiers.plain.bound(%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: %HasQualifiers.ref_this.type = name_ref ref_this, imports.%HasQualifiers.ref_this.decl [concrete = constants.%HasQualifiers.ref_this]
|
||||
// CHECK:STDOUT: %HasQualifiers.ref_this.bound: <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 %HasQualifiers.ref_this.bound(%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: %HasQualifiers.const_this.type = name_ref const_this, imports.%HasQualifiers.const_this.decl [concrete = constants.%HasQualifiers.const_this]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_this.bound.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: %HasQualifiers.const_ref_this.type = name_ref const_ref_this, imports.%HasQualifiers.const_ref_this.decl [concrete = constants.%HasQualifiers.const_ref_this]
|
||||
// CHECK:STDOUT: %HasQualifiers.const_ref_this.bound.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: %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: %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: %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: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- call_explicit_object_param.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_call_explicit_object_param.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %ExplicitObjectParam: type = class_type @ExplicitObjectParam [concrete]
|
||||
@@ -278,15 +319,17 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Another: type = class_type @Another [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.type: type = fn_type @ExplicitObjectParam.F [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F: %ExplicitObjectParam.F.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.3e2: type = cpp_overload_set_type @ExplicitObjectParam.G [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.48d: %.3e2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.7f5: type = ptr_type %ExplicitObjectParam [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type: type = fn_type @F__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk: %F__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.d44: type = cpp_overload_set_type @ExplicitObjectParam.H [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.a7c: %.d44 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.type: type = fn_type @ExplicitObjectParam.G [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G: %ExplicitObjectParam.G.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H.type: type = fn_type @ExplicitObjectParam.H [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H: %ExplicitObjectParam.H.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.9fb: type = cpp_overload_set_type @H__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %empty_struct.b14: %.9fb = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.289: type = ptr_type %Another [concrete]
|
||||
// CHECK:STDOUT: %H__carbon_thunk.type: type = fn_type @H__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %H__carbon_thunk: %H__carbon_thunk.type = struct_value () [concrete]
|
||||
@@ -300,26 +343,19 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.decl: type = class_decl @ExplicitObjectParam [concrete = constants.%ExplicitObjectParam] {} {}
|
||||
// CHECK:STDOUT: %Another.decl: type = class_decl @Another [concrete = constants.%Another] {} {}
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.decl: %ExplicitObjectParam.F.type = fn_decl @ExplicitObjectParam.F [concrete = constants.%ExplicitObjectParam.F] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.037: %.3e2 = cpp_overload_set_value @ExplicitObjectParam.G [concrete = constants.%empty_struct.48d]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.decl: %F__carbon_thunk.type = fn_decl @F__carbon_thunk [concrete = constants.%F__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.151: %.d44 = cpp_overload_set_value @ExplicitObjectParam.H [concrete = constants.%empty_struct.a7c]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.decl: %ExplicitObjectParam.G.type = fn_decl @ExplicitObjectParam.G [concrete = constants.%ExplicitObjectParam.G] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H.decl: %ExplicitObjectParam.H.type = fn_decl @ExplicitObjectParam.H [concrete = constants.%ExplicitObjectParam.H] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.34a: %.9fb = cpp_overload_set_value @H__carbon_thunk [concrete = constants.%empty_struct.b14]
|
||||
// CHECK:STDOUT: %H__carbon_thunk.decl: %H__carbon_thunk.type = fn_decl @H__carbon_thunk [concrete = constants.%H__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -330,25 +366,20 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: fn @Call(%e.param: %ExplicitObjectParam, %n.param: %i32, %a.param: %Another) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %e.ref: %ExplicitObjectParam = name_ref e, %e
|
||||
// CHECK:STDOUT: %F.ref: %ExplicitObjectParam.F.type = name_ref F, imports.%ExplicitObjectParam.F.decl [concrete = constants.%ExplicitObjectParam.F]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.bound: <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: %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: %n.ref: %i32 = name_ref n, %n
|
||||
// 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: %ExplicitObjectParam.G.type = name_ref G, imports.%ExplicitObjectParam.G.decl [concrete = constants.%ExplicitObjectParam.G]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.bound: <bound method> = bound_method %n.ref, %G.ref
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.G.call: init %empty_tuple.type = call %ExplicitObjectParam.G.bound(%n.ref)
|
||||
// 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: %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: %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]
|
||||
// CHECK:STDOUT: %H.ref: %ExplicitObjectParam.H.type = name_ref H, imports.%ExplicitObjectParam.H.decl [concrete = constants.%ExplicitObjectParam.H]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.H.bound: <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: %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: %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: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+12
-6
@@ -179,10 +179,10 @@ import Cpp library "dynamic.h";
|
||||
fn MyF(bar: Cpp.Bar*) {
|
||||
// CHECK:STDERR: fail_todo_call_dynamic.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Virtual function` [SemanticsTodo]
|
||||
// CHECK:STDERR: bar->f();
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_todo_call_dynamic.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `f` [InCppNameLookup]
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_call_dynamic.carbon:[[@LINE+4]]:3: note: in call to Cpp function here [InCallToCppFunction]
|
||||
// CHECK:STDERR: bar->f();
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
bar->f();
|
||||
}
|
||||
@@ -325,6 +325,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %.c07: type = cpp_overload_set_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.c07 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -335,6 +337,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %.617: %.c07 = cpp_overload_set_value @Bar.foo [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -342,8 +345,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.foo.type = name_ref foo, imports.%Bar.foo.decl [concrete = constants.%Bar.foo]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call %foo.ref()
|
||||
// CHECK:STDOUT: %foo.ref: %.c07 = name_ref foo, imports.%.617 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -478,6 +481,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.f68 [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.2e2: type = cpp_overload_set_type @<null name> [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.2e2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -486,6 +491,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %.6e0: %.2e2 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -507,7 +513,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.f68 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc15: ref %Bar = deref %bar.ref
|
||||
// CHECK:STDOUT: %f.ref: <error> = name_ref f, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %f.ref: %.2e2 = name_ref f, imports.%.6e0 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+31
-30
@@ -10,6 +10,8 @@
|
||||
// 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 {};
|
||||
@@ -22,7 +24,7 @@ template<typename T> struct A : Base {
|
||||
using Aint = A<int>;
|
||||
using Along = A<long>;
|
||||
|
||||
// --- use_class_template.carbon
|
||||
// --- fail_todo_5891_use_class_template.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
@@ -31,6 +33,11 @@ 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
|
||||
@@ -80,7 +87,7 @@ var x: Cpp.XY.r#type = 0;
|
||||
var y: Cpp.Xint.r#type = 0;
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// CHECK:STDOUT: --- use_class_template.carbon
|
||||
// CHECK:STDOUT: --- fail_todo_5891_use_class_template.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %A.0bedf0.1: type = class_type @A.1 [concrete]
|
||||
@@ -90,8 +97,8 @@ var y: Cpp.Xint.r#type = 0;
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %A.elem.c3f: type = unbound_element_type %A.0bedf0.1, %i32 [concrete]
|
||||
// CHECK:STDOUT: %A.f.type: type = fn_type @A.f [concrete]
|
||||
// CHECK:STDOUT: %A.f: %A.f.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %.658: type = cpp_overload_set_type @A.f [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.658 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %const.16f: type = const_type %A.0bedf0.1 [concrete]
|
||||
// CHECK:STDOUT: %ptr.703: type = ptr_type %const.16f [concrete]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.type: type = fn_type @f__carbon_thunk [concrete]
|
||||
@@ -122,11 +129,7 @@ var y: Cpp.Xint.r#type = 0;
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %A.f.decl: %A.f.type = fn_decl @A.f [concrete = constants.%A.f] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.d46: %.658 = cpp_overload_set_value @A.f [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %f__carbon_thunk.decl: %f__carbon_thunk.type = fn_decl @f__carbon_thunk [concrete = constants.%f__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -140,38 +143,36 @@ 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.loc9: %A.0bedf0.1 = name_ref x, %x
|
||||
// CHECK:STDOUT: %f.ref: %A.f.type = name_ref f, imports.%A.f.decl [concrete = constants.%A.f]
|
||||
// CHECK:STDOUT: %A.f.bound: <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: %x.ref.loc14: %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: %n.ref: %A.elem.c3f = name_ref n, @A.1.%.2 [concrete = @A.1.%.2]
|
||||
// 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: %.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: %impl.elem0: %.3c4 = impl_witness_access constants.%Copy.impl_witness.f0b, element0 [concrete = constants.%Int.as.Copy.impl.Op.87e]
|
||||
// CHECK:STDOUT: %bound_method.loc10_11.1: <bound method> = bound_method %.loc10_11.2, %impl.elem0
|
||||
// CHECK:STDOUT: %bound_method.loc15_11.1: <bound method> = bound_method %.loc15_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.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: %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: 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: %.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: %.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: %impl.elem0: %.e4a = impl_witness_access constants.%Copy.impl_witness.add, element0 [concrete = constants.%ptr.as.Copy.impl.Op.eb2]
|
||||
// CHECK:STDOUT: %bound_method.loc17_11.1: <bound method> = bound_method %.loc17_11.3, %impl.elem0
|
||||
// CHECK:STDOUT: %bound_method.loc22_11.1: <bound method> = bound_method %.loc22_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.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: %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: return %ptr.as.Copy.impl.Op.call to %return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+5
-2
@@ -289,6 +289,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %.c07: type = cpp_overload_set_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %empty_struct: %.c07 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -299,6 +301,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %.617: %.c07 = cpp_overload_set_value @Bar.foo [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -306,8 +309,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.foo.type = name_ref foo, imports.%Bar.foo.decl [concrete = constants.%Bar.foo]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call %foo.ref()
|
||||
// CHECK:STDOUT: %foo.ref: %.c07 = name_ref foo, imports.%.617 [concrete = constants.%empty_struct]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user