mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 07:51:05 +01:00
Rename and rearrange entities in tests to avoid name reuse (#7656)
Fix a bunch of cases where we use the same external name to mean multiple different things in the same test. We've historically gotten away with this, but under `--share-cpp-ast`, it becomes an error, at least if the entity is either defined in, or used from, C++ code. Assisted-by: Gemini via Antigravity (original change) and Claude Code (suggested edits in review) --------- Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
co-authored by
Chandler Carruth
parent
6eb900dff5
commit
c588eadb57
@@ -180,88 +180,115 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
// Multiple files with warnings
|
||||
// ============================================================================
|
||||
|
||||
// --- multi_one_warning.h
|
||||
|
||||
#warning "warning1"
|
||||
|
||||
// --- multi_multiple_warnings.h
|
||||
|
||||
#warning "warning1"
|
||||
#warning "warning2"
|
||||
#warning "warning3"
|
||||
|
||||
// --- import_multiple_cpp_files_with_warnings.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_warning.h";
|
||||
import Cpp library "multi_one_warning.h";
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multiple_warnings.h";
|
||||
import Cpp library "multi_multiple_warnings.h";
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
// Multiple files with errors and warnings
|
||||
// ============================================================================
|
||||
|
||||
// --- multi_one_error_and_one_warning.h
|
||||
|
||||
#error "error1"
|
||||
#warning "warning1"
|
||||
|
||||
// --- multi_multiple_errors_and_multiple_warnings.h
|
||||
|
||||
#error "error1"
|
||||
#error "error2"
|
||||
#warning "warning1"
|
||||
#warning "warning2"
|
||||
#warning "warning3"
|
||||
|
||||
// --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_error_and_one_warning.h";
|
||||
import Cpp library "multi_one_error_and_one_warning.h";
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+25]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+20]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: 3 | #error "error2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 5 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
// ============================================================================
|
||||
// Indirect error
|
||||
// ============================================================================
|
||||
|
||||
// --- indirect_one_error.h
|
||||
|
||||
#error "error1"
|
||||
|
||||
// --- indirect_error.h
|
||||
|
||||
#include "one_error.h"
|
||||
#include "indirect_one_error.h"
|
||||
|
||||
// --- fail_import_indirect_error.carbon
|
||||
|
||||
@@ -269,7 +296,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_indirect_error.carbon:[[@LINE+6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_error.h:2:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ./indirect_one_error.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
@@ -279,9 +306,13 @@ import Cpp library "indirect_error.h";
|
||||
// Indirect warning
|
||||
// ============================================================================
|
||||
|
||||
// --- indirect_one_warning.h
|
||||
|
||||
#warning "warning1"
|
||||
|
||||
// --- indirect_warning.h
|
||||
|
||||
#include "one_warning.h"
|
||||
#include "indirect_one_warning.h"
|
||||
|
||||
// --- import_indirect_warning.carbon
|
||||
|
||||
@@ -290,7 +321,7 @@ library "[[@TEST_NAME]]";
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_indirect_warning.carbon:[[@LINE+6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_warning.h:2:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./indirect_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
@@ -301,6 +332,10 @@ import Cpp library "indirect_warning.h";
|
||||
// Lexer error before import
|
||||
// ============================================================================
|
||||
|
||||
// --- lexer_error_one_warning.h
|
||||
|
||||
#warning "warning1"
|
||||
|
||||
// --- fail_import_cpp_library_lexer_error.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
@@ -309,7 +344,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
// TODO: Move this warning to be after the lexer error.
|
||||
// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE+9]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ./lexer_error_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
@@ -317,7 +352,7 @@ library "[[@TEST_NAME]]";
|
||||
// CHECK:STDERR: //!Lexer error: whitespace is required after the comment introducer.
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_warning.h";
|
||||
import Cpp library "lexer_error_one_warning.h";
|
||||
|
||||
// ============================================================================
|
||||
// Diagnostic with fix-it hints
|
||||
@@ -465,8 +500,8 @@ void f(const int n) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
|
||||
// CHECK:STDOUT: import Cpp "one_warning.h"
|
||||
// CHECK:STDOUT: import Cpp "multiple_warnings.h"
|
||||
// CHECK:STDOUT: import Cpp "multi_one_warning.h"
|
||||
// CHECK:STDOUT: import Cpp "multi_multiple_warnings.h"
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -38,21 +38,21 @@ library "[[@TEST_NAME]]";
|
||||
// TODO: This diagnostic isn't very good.
|
||||
import Cpp inline '''
|
||||
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+15]]:1: error: module declaration must not come from an #include directive [CppInteropParseError]
|
||||
// CHECK:STDERR: 21 | module Foo;
|
||||
// CHECK:STDERR: 21 | module Bar;
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+11]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError]
|
||||
// CHECK:STDERR: 21 | module Foo;
|
||||
// CHECK:STDERR: 21 | module Bar;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote]
|
||||
// CHECK:STDERR: 1 | ;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module 'Foo' not found [CppInteropParseError]
|
||||
// CHECK:STDERR: 21 | module Foo;
|
||||
// CHECK:STDERR: | ^~~~
|
||||
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError]
|
||||
// CHECK:STDERR: 21 | module Bar;
|
||||
// CHECK:STDERR: | ^~~
|
||||
// CHECK:STDERR:
|
||||
module Foo;
|
||||
module Bar;
|
||||
''';
|
||||
|
||||
// --- fail_global_module_in_inline_cpp.carbon
|
||||
@@ -74,21 +74,21 @@ module;
|
||||
int n;
|
||||
|
||||
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+15]]:1: error: module declaration must not come from an #include directive [CppInteropParseError]
|
||||
// CHECK:STDERR: 33 | module Foo;
|
||||
// CHECK:STDERR: 33 | module Baz;
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+11]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError]
|
||||
// CHECK:STDERR: 33 | module Foo;
|
||||
// CHECK:STDERR: 33 | module Baz;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote]
|
||||
// CHECK:STDERR: 1 | ;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module 'Foo' not found [CppInteropParseError]
|
||||
// CHECK:STDERR: 33 | module Foo;
|
||||
// CHECK:STDERR: | ^~~~
|
||||
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError]
|
||||
// CHECK:STDERR: 33 | module Baz;
|
||||
// CHECK:STDERR: | ^~~
|
||||
// CHECK:STDERR:
|
||||
module Foo;
|
||||
module Baz;
|
||||
''';
|
||||
|
||||
// --- fail_import_in_inline_cpp.carbon
|
||||
|
||||
+56
-56
@@ -32,23 +32,23 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
base class A {
|
||||
base class LookupBase {
|
||||
fn F();
|
||||
fn G(n: i32);
|
||||
}
|
||||
|
||||
class B {
|
||||
extend base: A;
|
||||
class LookupDerived {
|
||||
extend base: LookupBase;
|
||||
fn G();
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void Qualified() {
|
||||
Carbon::B::F();
|
||||
Carbon::B::G();
|
||||
Carbon::LookupDerived::F();
|
||||
Carbon::LookupDerived::G();
|
||||
}
|
||||
|
||||
void MemberAccess(Carbon::A *a, Carbon::B *b) {
|
||||
void MemberAccess(Carbon::LookupBase *a, Carbon::LookupDerived *b) {
|
||||
b->F();
|
||||
b->G();
|
||||
}
|
||||
@@ -59,17 +59,17 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class Final {}
|
||||
class FinalClass {}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+7]]:12: error: base 'Final' is marked 'final' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | struct A : Carbon::Final {};
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+7]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | struct A : Carbon::FinalClass {};
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-6]]:13: note: 'Final' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class Final {}
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-6]]:18: note: 'FinalClass' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FinalClass {}
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
struct A : Carbon::Final {};
|
||||
struct A : Carbon::FinalClass {};
|
||||
''';
|
||||
|
||||
// --- fail_abstract.carbon
|
||||
@@ -84,23 +84,23 @@ struct VirtualDestructor {
|
||||
};
|
||||
''';
|
||||
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithVdtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithVdtor {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class Abstract {
|
||||
abstract class AbstractWithVdtor {
|
||||
extend base: Cpp.VirtualDestructor;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+7]]:18: error: variable type 'Carbon::Abstract' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 28 | Carbon::Abstract x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-8]]:25: note: unimplemented pure virtual method '~Abstract' in 'Abstract' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 16 | abstract class Abstract {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+7]]:27: error: variable type 'Carbon::AbstractWithVdtor' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 28 | Carbon::AbstractWithVdtor x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-8]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 16 | abstract class AbstractWithVdtor {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::Abstract x;
|
||||
Carbon::AbstractWithVdtor x;
|
||||
''';
|
||||
|
||||
// --- fail_todo_abstract_nonvirtual_dtor.carbon
|
||||
@@ -111,17 +111,17 @@ import Cpp;
|
||||
// TODO: Find a way to export this to C++ as an abstract class, despite not
|
||||
// having a vptr.
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+8]]:1: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: abstract class Abstract {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: abstract class AbstractNonvirtualDtor {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class Abstract {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractNonvirtualDtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractNonvirtualDtor {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class Abstract {}
|
||||
abstract class AbstractNonvirtualDtor {}
|
||||
|
||||
inline Cpp '''
|
||||
class Derived : public Carbon::Abstract {};
|
||||
class DerivedNonvirtualDtor : public Carbon::AbstractNonvirtualDtor {};
|
||||
''';
|
||||
|
||||
// --- fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon
|
||||
@@ -132,16 +132,16 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethodNoVptr` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithMethodNoVptr {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class Abstract {
|
||||
abstract class AbstractWithMethodNoVptr {
|
||||
abstract fn F(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
class Derived : public Carbon::Abstract {
|
||||
class DerivedWithMethodNoVptr : public Carbon::AbstractWithMethodNoVptr {
|
||||
};
|
||||
''';
|
||||
|
||||
@@ -153,23 +153,23 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethod` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithMethod {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class Abstract {
|
||||
abstract class AbstractWithMethod {
|
||||
abstract fn F(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+7]]:18: error: variable type 'Carbon::Abstract' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::Abstract x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-7]]:22: note: unimplemented pure virtual method 'F' in 'Abstract' [CppInteropParseNote]
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+7]]:28: error: variable type 'Carbon::AbstractWithMethod' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::AbstractWithMethod x_abstract;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-7]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 13 | abstract fn F(self);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::Abstract x;
|
||||
Carbon::AbstractWithMethod x_abstract;
|
||||
''';
|
||||
|
||||
// --- fail_todo_abstract_method_overridden_in_cpp.carbon
|
||||
@@ -180,20 +180,20 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `Abstract` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class Abstract {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractToOverride` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractToOverride {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
abstract class Abstract {
|
||||
abstract class AbstractToOverride {
|
||||
abstract fn F(ref self);
|
||||
}
|
||||
|
||||
// A C++ class that overrides the abstract method can be instantiated.
|
||||
inline Cpp '''
|
||||
struct Derived : Carbon::Abstract {
|
||||
struct DerivedOverriding : Carbon::AbstractToOverride {
|
||||
void F() & override {}
|
||||
};
|
||||
Derived d;
|
||||
DerivedOverriding d;
|
||||
''';
|
||||
|
||||
// --- override_virtual_dtor.carbon
|
||||
@@ -202,15 +202,15 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
inline Cpp '''
|
||||
struct A {
|
||||
virtual ~A() = 0;
|
||||
struct BaseWithPureVdtor {
|
||||
virtual ~BaseWithPureVdtor() = 0;
|
||||
};
|
||||
''';
|
||||
|
||||
class B {
|
||||
extend base: Cpp.A;
|
||||
class DerivedWithVdtor {
|
||||
extend base: Cpp.BaseWithPureVdtor;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
Carbon::B b;
|
||||
Carbon::DerivedWithVdtor b;
|
||||
''';
|
||||
|
||||
+20
-20
@@ -15,13 +15,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class StaticMembers {
|
||||
fn F() {}
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
Carbon::A::F();
|
||||
void CallStaticMember() {
|
||||
Carbon::StaticMembers::F();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -30,16 +30,16 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class B {
|
||||
class C {
|
||||
class OuterA {
|
||||
class InnerB {
|
||||
class NestedC {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
Carbon::A::B::C *p = nullptr;
|
||||
void TestNested() {
|
||||
Carbon::OuterA::InnerB::NestedC *nested_p = nullptr;
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -48,10 +48,10 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class A;
|
||||
class IncompleteA;
|
||||
|
||||
inline Cpp '''
|
||||
Carbon::A *p = nullptr;
|
||||
Carbon::IncompleteA *incomplete_p = nullptr;
|
||||
''';
|
||||
|
||||
// --- fail_incomplete_concrete.carbon
|
||||
@@ -60,20 +60,20 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+4]]:1: error: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class A;
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: class IncompleteConcreteA;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class A;
|
||||
class IncompleteConcreteA;
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:11: error: variable has incomplete type 'Carbon::A' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::A a;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:8: note: forward declaration of 'Carbon::A' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | class A;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | class IncompleteConcreteA;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::A a;
|
||||
Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
''';
|
||||
|
||||
// --- fail_todo_monomorphization_failure.carbon
|
||||
|
||||
+29
-29
@@ -14,14 +14,14 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class TwoIntFields {
|
||||
var x: i32;
|
||||
var y: i32;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::A a;
|
||||
void AccessTwoFields() {
|
||||
Carbon::TwoIntFields a;
|
||||
a.x = 12;
|
||||
a.y = 34;
|
||||
}
|
||||
@@ -31,18 +31,18 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
base class A {
|
||||
base class BaseWithField {
|
||||
var x: i32;
|
||||
}
|
||||
|
||||
class B {
|
||||
extend base: A;
|
||||
class DerivedWithField {
|
||||
extend base: BaseWithField;
|
||||
var y: i32;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::B b;
|
||||
void AccessInheritedField() {
|
||||
Carbon::DerivedWithField b;
|
||||
b.x = 12;
|
||||
b.y = 34;
|
||||
}
|
||||
@@ -70,17 +70,17 @@ void g() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A {}
|
||||
class EmptyClass {}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::A a;
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::A' [CppInteropParseError]
|
||||
void AccessNonexistentField() {
|
||||
Carbon::EmptyClass a;
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 13 | a.x = 12;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
a.x = 12;
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::A' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 18 | a.y = 34;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
@@ -92,7 +92,7 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class UnsupportedFieldType {
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: var x: ();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
@@ -106,14 +106,14 @@ class A {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::A a;
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::A' [CppInteropParseError]
|
||||
void AccessUnsupportedField() {
|
||||
Carbon::UnsupportedFieldType a;
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | a.x;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
a.x;
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::A' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR: 29 | a.y;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
@@ -125,14 +125,14 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A {
|
||||
class AdaptedClass {
|
||||
adapt ();
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::A a;
|
||||
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::A' [CppInteropParseError]
|
||||
void AccessAdaptedField() {
|
||||
Carbon::AdaptedClass a;
|
||||
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::AdaptedClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | a.x = 12;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
@@ -145,7 +145,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// This should not cause a crash.
|
||||
class A {
|
||||
class InvalidBaseClass {
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:16: error: name `Whoops` not found [NameNotFound]
|
||||
// CHECK:STDERR: extend base: Whoops;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
@@ -154,15 +154,15 @@ class A {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
Carbon::A x;
|
||||
Carbon::InvalidBaseClass invalid_x;
|
||||
''';
|
||||
|
||||
// --- fail_private_field.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
fn Make() -> C {
|
||||
class ClassWithPrivateField {
|
||||
fn Make() -> ClassWithPrivateField {
|
||||
return {.x = 123};
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ class C {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int F() {
|
||||
auto c = Carbon::C::Make();
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+7]]:12: error: 'x' is a private member of 'Carbon::C' [CppInteropParseError]
|
||||
int AccessPrivateField() {
|
||||
auto c = Carbon::ClassWithPrivateField::Make();
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+7]]:12: error: 'x' is a private member of 'Carbon::ClassWithPrivateField' [CppInteropParseError]
|
||||
// CHECK:STDERR: 22 | return c.x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE-9]]:16: note: implicitly declared private here [CppInteropParseNote]
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C(T: type) {
|
||||
class GenericClass(T: type) {
|
||||
var t: T;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C<int> c;
|
||||
void FGeneric() {
|
||||
Carbon::GenericClass<int> c;
|
||||
c.t = 123;
|
||||
}
|
||||
''';
|
||||
@@ -29,14 +29,14 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C(T: type) {
|
||||
class SpecificClass(T: type) {
|
||||
var t: T;
|
||||
}
|
||||
alias A = C(i32);
|
||||
alias AliasInt = SpecificClass(i32);
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::A a;
|
||||
void FSpecific() {
|
||||
Carbon::AliasInt a;
|
||||
a.t = 123;
|
||||
}
|
||||
''';
|
||||
@@ -46,25 +46,25 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: class C(T: type) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: class UnsupportedClass(T: type) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
class C(T: type) {
|
||||
class UnsupportedClass(T: type) {
|
||||
var t: T;
|
||||
}
|
||||
alias A = C(());
|
||||
alias AliasEmptyTuple = UnsupportedClass(());
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
void FUnsupported() {
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+8]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR: Carbon::A a;
|
||||
// CHECK:STDERR: Carbon::AliasEmptyTuple a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: no type named 'A' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | Carbon::A a;
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | Carbon::AliasEmptyTuple a;
|
||||
// CHECK:STDERR: | ~~~~~~~~^
|
||||
// CHECK:STDERR:
|
||||
Carbon::A a;
|
||||
Carbon::AliasEmptyTuple a;
|
||||
a.t = 123;
|
||||
}
|
||||
''';
|
||||
@@ -73,7 +73,7 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C(T: type) {
|
||||
class ClassWithMethod(T: type) {
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn M(unused ref self) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -82,9 +82,9 @@ class C(T: type) {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C<int> c;
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:5: error: no member named 'M' in 'Carbon::C<int>' [CppInteropParseError]
|
||||
void FMethodCall() {
|
||||
Carbon::ClassWithMethod<int> c;
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:5: error: no member named 'M' in 'Carbon::ClassWithMethod<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | c.M();
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
|
||||
+10
-10
@@ -15,15 +15,15 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class ThreeInts {
|
||||
var a: i32;
|
||||
var b: i32;
|
||||
var c: i32;
|
||||
}
|
||||
|
||||
inline Cpp '''c++
|
||||
static_assert(sizeof(Carbon::C) == 12);
|
||||
static_assert(alignof(Carbon::C) == 4);
|
||||
static_assert(sizeof(Carbon::ThreeInts) == 12);
|
||||
static_assert(alignof(Carbon::ThreeInts) == 4);
|
||||
''';
|
||||
|
||||
// --- packed.carbon
|
||||
@@ -31,19 +31,19 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class PointerInt {
|
||||
var a: i32*;
|
||||
var b: i32;
|
||||
}
|
||||
|
||||
class D {
|
||||
var c: C;
|
||||
class PointerIntInt {
|
||||
var c: PointerInt;
|
||||
var d: i32;
|
||||
}
|
||||
|
||||
inline Cpp '''c++
|
||||
static_assert(sizeof(Carbon::C) == 12);
|
||||
static_assert(alignof(Carbon::C) == 8);
|
||||
static_assert(sizeof(Carbon::D) == 16);
|
||||
static_assert(alignof(Carbon::D) == 8);
|
||||
static_assert(sizeof(Carbon::PointerInt) == 12);
|
||||
static_assert(alignof(Carbon::PointerInt) == 8);
|
||||
static_assert(sizeof(Carbon::PointerIntInt) == 16);
|
||||
static_assert(alignof(Carbon::PointerIntInt) == 8);
|
||||
''';
|
||||
|
||||
+21
-21
@@ -14,13 +14,13 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class StaticMethodClass {
|
||||
fn M();
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C::M();
|
||||
void StaticMethod() {
|
||||
Carbon::StaticMethodClass::M();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -28,13 +28,13 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class MethodLValueClass {
|
||||
fn M(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C c;
|
||||
void MethodLValue() {
|
||||
Carbon::MethodLValueClass c;
|
||||
c.M();
|
||||
}
|
||||
''';
|
||||
@@ -43,13 +43,13 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class MethodRValueClass {
|
||||
fn M(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C().M();
|
||||
void MethodRValue() {
|
||||
Carbon::MethodRValueClass().M();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -57,12 +57,12 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class MethodConstLValueClass {
|
||||
fn M(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F(const Carbon::C& c) {
|
||||
void MethodConstLValue(const Carbon::MethodConstLValueClass& c) {
|
||||
c.M();
|
||||
}
|
||||
''';
|
||||
@@ -71,13 +71,13 @@ void F(const Carbon::C& c) {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class RefMethodLValueClass {
|
||||
fn M(ref self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
Carbon::C c;
|
||||
void RefMethodLValue() {
|
||||
Carbon::RefMethodLValueClass c;
|
||||
c.M();
|
||||
}
|
||||
''';
|
||||
@@ -86,20 +86,20 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class RefMethodRValueClass {
|
||||
fn M(ref self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
void RefMethodRValue() {
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::C().M();
|
||||
// CHECK:STDERR: 17 | Carbon::RefMethodRValueClass().M();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | fn M(ref self);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::C().M();
|
||||
Carbon::RefMethodRValueClass().M();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -107,13 +107,13 @@ void F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class RefMethodConstLValueClass {
|
||||
fn M(ref self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void F(const Carbon::C& c) {
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::C', but function is not marked const [CppInteropParseError]
|
||||
void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) {
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass', but function is not marked const [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | c.M();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class PublicClass {
|
||||
static var x: i32 = 123;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int F() {
|
||||
return Carbon::C::x;
|
||||
int PublicStatic() {
|
||||
return Carbon::PublicClass::x;
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -28,19 +28,19 @@ int F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class C {
|
||||
class PrivateClass {
|
||||
private static var x: i32 = 123;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int F() {
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:21: error: 'x' is a private member of 'Carbon::C' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | return Carbon::C::x;
|
||||
// CHECK:STDERR: | ^
|
||||
int PrivateStatic() {
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | return Carbon::PrivateClass::x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-8]]:23: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | private static var x: i32 = 123;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
return Carbon::C::x;
|
||||
return Carbon::PrivateClass::x;
|
||||
}
|
||||
''';
|
||||
|
||||
+401
-402
File diff suppressed because it is too large
Load Diff
+160
-160
@@ -37,12 +37,12 @@ fn ConvertVal(d: Cpp.Derived) {
|
||||
|
||||
// --- static_member.h
|
||||
|
||||
class Base {
|
||||
class StaticBase {
|
||||
public:
|
||||
static auto base_fn() -> void;
|
||||
};
|
||||
|
||||
class Derived : public Base {
|
||||
class StaticDerived : public StaticBase {
|
||||
public:
|
||||
static auto derived_fn() -> void;
|
||||
};
|
||||
@@ -55,20 +55,20 @@ import Cpp library "static_member.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.Base.base_fn();
|
||||
Cpp.Derived.base_fn();
|
||||
Cpp.Derived.derived_fn();
|
||||
Cpp.StaticBase.base_fn();
|
||||
Cpp.StaticDerived.base_fn();
|
||||
Cpp.StaticDerived.derived_fn();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- base_field.h
|
||||
|
||||
struct Base {
|
||||
struct FieldBase {
|
||||
int a;
|
||||
int b;
|
||||
};
|
||||
|
||||
struct Derived : Base {
|
||||
struct FieldDerived : FieldBase {
|
||||
int b;
|
||||
};
|
||||
|
||||
@@ -78,26 +78,26 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "base_field.h";
|
||||
|
||||
fn AccessDirect(d: Cpp.Derived) -> i32 {
|
||||
fn AccessDirect(d: Cpp.FieldDerived) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return d.a;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn AccessQualified(d: Cpp.Derived) -> i32 {
|
||||
fn AccessQualified(d: Cpp.FieldDerived) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return d.(Cpp.Base.b);
|
||||
return d.(Cpp.FieldBase.b);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- base_method.h
|
||||
|
||||
struct Base {
|
||||
struct MethodBase {
|
||||
void f() const;
|
||||
void g() const;
|
||||
};
|
||||
|
||||
struct Derived : Base {
|
||||
struct MethodDerived : MethodBase {
|
||||
void g() const;
|
||||
};
|
||||
|
||||
@@ -107,25 +107,25 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "base_method.h";
|
||||
|
||||
fn CallDirect(d: Cpp.Derived) {
|
||||
fn CallDirect(d: Cpp.MethodDerived) {
|
||||
//@dump-sem-ir-begin
|
||||
d.f();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn CallQualified(d: Cpp.Derived) {
|
||||
fn CallQualified(d: Cpp.MethodDerived) {
|
||||
//@dump-sem-ir-begin
|
||||
d.(Cpp.Base.g)();
|
||||
d.(Cpp.MethodBase.g)();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn CallBaseQualifiedByDerived(d: Cpp.Derived, b: Cpp.Base) {
|
||||
fn CallBaseQualifiedByDerived(d: Cpp.MethodDerived, b: Cpp.MethodBase) {
|
||||
//@dump-sem-ir-begin
|
||||
// `Cpp.Derived.f` names a member of `Cpp.Base`, so we allow that to be used
|
||||
// when `self` is a `Cpp.Base` or anything that implicitly converts to
|
||||
// `Cpp.Base`, such as `Cpp.Derived`.
|
||||
d.(Cpp.Derived.f)();
|
||||
b.(Cpp.Derived.f)();
|
||||
// `Cpp.MethodDerived.f` names a member of `Cpp.MethodBase`, so we allow
|
||||
// that to be used when `self` is a `Cpp.MethodBase` or anything that
|
||||
// implicitly converts to `Cpp.MethodBase`, such as `Cpp.MethodDerived`.
|
||||
d.(Cpp.MethodDerived.f)();
|
||||
b.(Cpp.MethodDerived.f)();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -285,10 +285,10 @@ fn ConvertOnePolymorphicBaseToPolymorphic1(p: Cpp.OnePolymorphicBase*) -> Cpp.Po
|
||||
|
||||
// --- virtual_inheritance.h
|
||||
|
||||
struct A { int a; };
|
||||
struct B : virtual A {};
|
||||
struct VirtA { int a; };
|
||||
struct VirtB : virtual VirtA {};
|
||||
|
||||
void UseB(B * _Nonnull p);
|
||||
void UseB(VirtB * _Nonnull p);
|
||||
|
||||
// --- use_virtual_inheritance_incomplete.carbon
|
||||
|
||||
@@ -296,8 +296,8 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "virtual_inheritance.h";
|
||||
|
||||
fn Convert(p: Cpp.B*) {
|
||||
// OK, doesn't require `Cpp.B` to be a complete type.
|
||||
fn Convert(p: Cpp.VirtB*) {
|
||||
// OK, doesn't require `Cpp.VirtB` to be a complete type.
|
||||
Cpp.UseB(p);
|
||||
}
|
||||
|
||||
@@ -307,11 +307,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "virtual_inheritance.h";
|
||||
|
||||
fn Convert(p: Cpp.B*) -> Cpp.A* {
|
||||
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure]
|
||||
fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* {
|
||||
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.VirtB*` to `Cpp.VirtA*` [ConversionFailure]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+4]]:3: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
@@ -320,19 +320,19 @@ fn Convert(p: Cpp.B*) -> Cpp.A* {
|
||||
|
||||
// --- diamond.h
|
||||
|
||||
struct A {
|
||||
struct DiamondA {
|
||||
int a;
|
||||
};
|
||||
|
||||
struct B : virtual A {
|
||||
struct DiamondB : virtual DiamondA {
|
||||
int b;
|
||||
};
|
||||
|
||||
struct C : virtual A {
|
||||
struct DiamondC : virtual DiamondA {
|
||||
int c;
|
||||
};
|
||||
|
||||
struct D : B, C {
|
||||
struct DiamondD : DiamondB, DiamondC {
|
||||
int d;
|
||||
};
|
||||
|
||||
@@ -342,88 +342,88 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "diamond.h";
|
||||
|
||||
fn ConvertBA(p: Cpp.B*) -> Cpp.A* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.B*` to `Cpp.A*` [ConversionFailure]
|
||||
fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.DiamondB*` to `Cpp.DiamondA*` [ConversionFailure]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.B*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return p;
|
||||
}
|
||||
|
||||
fn ConvertCA(p: Cpp.C*) -> Cpp.A* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.C*` to `Cpp.A*` [ConversionFailure]
|
||||
fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.DiamondC*` to `Cpp.DiamondA*` [ConversionFailure]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return p;
|
||||
}
|
||||
|
||||
fn ConvertDB(p: Cpp.D*) -> Cpp.B* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.D*` to `Cpp.B*` [ConversionFailure]
|
||||
fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.DiamondD*` to `Cpp.DiamondB*` [ConversionFailure]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return p;
|
||||
}
|
||||
|
||||
fn ConvertDC(p: Cpp.D*) -> Cpp.C* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.D*` to `Cpp.C*` [ConversionFailure]
|
||||
fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:3: error: cannot implicitly convert expression of type `Cpp.DiamondD*` to `Cpp.DiamondC*` [ConversionFailure]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.D*` does not implement interface `Core.ImplicitAs(Cpp.C*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:3: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return p;
|
||||
// CHECK:STDERR: ^~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return p;
|
||||
}
|
||||
|
||||
fn AccessBA(d: Cpp.D) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.D` to `Cpp.B` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: return (d as Cpp.B).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return (d as Cpp.B).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
fn AccessBA(d: Cpp.DiamondD) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: return (d as Cpp.DiamondB).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return (d as Cpp.DiamondB).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return (d as Cpp.B).b;
|
||||
return (d as Cpp.DiamondB).b;
|
||||
}
|
||||
|
||||
fn AccessCA(d: Cpp.D) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.D` to `Cpp.C` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: return (d as Cpp.C).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.D` does not implement interface `Core.As(Cpp.C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return (d as Cpp.C).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
fn AccessCA(d: Cpp.DiamondD) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `Cpp.DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure]
|
||||
// CHECK:STDERR: return (d as Cpp.DiamondC).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:11: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return (d as Cpp.DiamondC).b;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
return (d as Cpp.C).b;
|
||||
return (d as Cpp.DiamondC).b;
|
||||
}
|
||||
|
||||
fn AccessDB(d: Cpp.D) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.D` to `Cpp.B` [ConversionFailure]
|
||||
fn AccessDB(d: Cpp.DiamondD) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.DiamondD` to `Cpp.DiamondB` [ConversionFailure]
|
||||
// CHECK:STDERR: return d.b;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return d.b;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
return d.b;
|
||||
}
|
||||
|
||||
fn AccessDC(d: Cpp.D) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.D` to `Cpp.C` [ConversionFailure]
|
||||
fn AccessDC(d: Cpp.DiamondD) -> i32 {
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+7]]:10: error: cannot implicitly convert expression of type `Cpp.DiamondD` to `Cpp.DiamondC` [ConversionFailure]
|
||||
// CHECK:STDERR: return d.c;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.D` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+4]]:10: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: return d.c;
|
||||
// CHECK:STDERR: ^~~
|
||||
// CHECK:STDERR:
|
||||
@@ -432,7 +432,7 @@ fn AccessDC(d: Cpp.D) -> i32 {
|
||||
|
||||
// --- final.h
|
||||
|
||||
struct A final {};
|
||||
struct FinalA final {};
|
||||
|
||||
// --- fail_derive_from_final.carbon
|
||||
|
||||
@@ -441,11 +441,11 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "final.h";
|
||||
|
||||
class B {
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `A`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: Cpp.A;
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+4]]:16: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal]
|
||||
// CHECK:STDERR: extend base: Cpp.FinalA;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
extend base: Cpp.A;
|
||||
extend base: Cpp.FinalA;
|
||||
}
|
||||
|
||||
// --- union.h
|
||||
@@ -580,61 +580,61 @@ class V {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %Base.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @Base.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Base.base_fn.cpp_overload_set.value: %Base.base_fn.cpp_overload_set.type = cpp_overload_set_value @Base.base_fn.cpp_overload_set [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: %Derived.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @Derived.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Derived.base_fn.cpp_overload_set.value: %Derived.base_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.type: type = cpp_overload_set_type @Derived.derived_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.value: %Derived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.derived_fn.cpp_overload_set [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: %StaticBase: type = class_type @StaticBase [concrete]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @StaticBase.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.cpp_overload_set.value: %StaticBase.base_fn.cpp_overload_set.type = cpp_overload_set_value @StaticBase.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.type: type = fn_type @StaticBase.base_fn [concrete]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn: %StaticBase.base_fn.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived: type = class_type @StaticDerived [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.base_fn.cpp_overload_set.type: type = cpp_overload_set_type @StaticDerived.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.base_fn.cpp_overload_set.value: %StaticDerived.base_fn.cpp_overload_set.type = cpp_overload_set_value @StaticDerived.base_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.cpp_overload_set.type: type = cpp_overload_set_type @StaticDerived.derived_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.cpp_overload_set.value: %StaticDerived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @StaticDerived.derived_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.type: type = fn_type @StaticDerived.derived_fn [concrete]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn: %StaticDerived.derived_fn.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Base = %Base.decl
|
||||
// CHECK:STDOUT: .Derived = %Derived.decl
|
||||
// CHECK:STDOUT: .StaticBase = %StaticBase.decl
|
||||
// CHECK:STDOUT: .StaticDerived = %StaticDerived.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Base.decl: type = class_decl @Base [concrete = constants.%Base] {} {}
|
||||
// CHECK:STDOUT: %Base.base_fn.cpp_overload_set.value: %Base.base_fn.cpp_overload_set.type = cpp_overload_set_value @Base.base_fn.cpp_overload_set [concrete = constants.%Base.base_fn.cpp_overload_set.value]
|
||||
// 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: %Derived.base_fn.cpp_overload_set.value: %Derived.base_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.base_fn.cpp_overload_set [concrete = constants.%Derived.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.cpp_overload_set.value: %Derived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @Derived.derived_fn.cpp_overload_set [concrete = constants.%Derived.derived_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.decl: %Derived.derived_fn.type = fn_decl @Derived.derived_fn [concrete = constants.%Derived.derived_fn] {} {}
|
||||
// CHECK:STDOUT: %StaticBase.decl: type = class_decl @StaticBase [concrete = constants.%StaticBase] {} {}
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.cpp_overload_set.value: %StaticBase.base_fn.cpp_overload_set.type = cpp_overload_set_value @StaticBase.base_fn.cpp_overload_set [concrete = constants.%StaticBase.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.decl: %StaticBase.base_fn.type = fn_decl @StaticBase.base_fn [concrete = constants.%StaticBase.base_fn] {} {}
|
||||
// CHECK:STDOUT: %StaticDerived.decl: type = class_decl @StaticDerived [concrete = constants.%StaticDerived] {} {}
|
||||
// CHECK:STDOUT: %StaticDerived.base_fn.cpp_overload_set.value: %StaticDerived.base_fn.cpp_overload_set.type = cpp_overload_set_value @StaticDerived.base_fn.cpp_overload_set [concrete = constants.%StaticDerived.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.cpp_overload_set.value: %StaticDerived.derived_fn.cpp_overload_set.type = cpp_overload_set_value @StaticDerived.derived_fn.cpp_overload_set [concrete = constants.%StaticDerived.derived_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.decl: %StaticDerived.derived_fn.type = fn_decl @StaticDerived.derived_fn [concrete = constants.%StaticDerived.derived_fn] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// 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.cpp_overload_set.type = name_ref base_fn, imports.%Base.base_fn.cpp_overload_set.value [concrete = constants.%Base.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc8: init %empty_tuple.type = call imports.%Base.base_fn.decl()
|
||||
// CHECK:STDOUT: %StaticBase.ref: type = name_ref StaticBase, imports.%StaticBase.decl [concrete = constants.%StaticBase]
|
||||
// CHECK:STDOUT: %base_fn.ref.loc8: %StaticBase.base_fn.cpp_overload_set.type = name_ref base_fn, imports.%StaticBase.base_fn.cpp_overload_set.value [concrete = constants.%StaticBase.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.call.loc8: init %empty_tuple.type = call imports.%StaticBase.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: %Derived.base_fn.cpp_overload_set.type = name_ref base_fn, imports.%Derived.base_fn.cpp_overload_set.value [concrete = constants.%Derived.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Base.base_fn.call.loc9: init %empty_tuple.type = call imports.%Base.base_fn.decl()
|
||||
// CHECK:STDOUT: %StaticDerived.ref.loc9: type = name_ref StaticDerived, imports.%StaticDerived.decl [concrete = constants.%StaticDerived]
|
||||
// CHECK:STDOUT: %base_fn.ref.loc9: %StaticDerived.base_fn.cpp_overload_set.type = name_ref base_fn, imports.%StaticDerived.base_fn.cpp_overload_set.value [concrete = constants.%StaticDerived.base_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticBase.base_fn.call.loc9: init %empty_tuple.type = call imports.%StaticBase.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.cpp_overload_set.type = name_ref derived_fn, imports.%Derived.derived_fn.cpp_overload_set.value [concrete = constants.%Derived.derived_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Derived.derived_fn.call: init %empty_tuple.type = call imports.%Derived.derived_fn.decl()
|
||||
// CHECK:STDOUT: %StaticDerived.ref.loc10: type = name_ref StaticDerived, imports.%StaticDerived.decl [concrete = constants.%StaticDerived]
|
||||
// CHECK:STDOUT: %derived_fn.ref: %StaticDerived.derived_fn.cpp_overload_set.type = name_ref derived_fn, imports.%StaticDerived.derived_fn.cpp_overload_set.value [concrete = constants.%StaticDerived.derived_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticDerived.derived_fn.call: init %empty_tuple.type = call imports.%StaticDerived.derived_fn.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- use_base_field.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
// CHECK:STDOUT: %FieldDerived: type = class_type @FieldDerived [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete]
|
||||
// CHECK:STDOUT: %FieldBase: type = class_type @FieldBase [concrete]
|
||||
// CHECK:STDOUT: %FieldBase.elem: type = unbound_element_type %FieldBase, %i32 [concrete]
|
||||
// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.ac8: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.5e0: %Int.as.Copy.impl.Op.type.ac8 = struct_value () [symbolic]
|
||||
@@ -649,23 +649,23 @@ class V {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Derived = %Derived.decl
|
||||
// CHECK:STDOUT: .Base = %Base.decl
|
||||
// CHECK:STDOUT: .FieldDerived = %FieldDerived.decl
|
||||
// CHECK:STDOUT: .FieldBase = %FieldBase.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// 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: %FieldDerived.decl: type = class_decl @FieldDerived [concrete = constants.%FieldDerived] {} {}
|
||||
// CHECK:STDOUT: %FieldBase.decl: type = class_decl @FieldBase [concrete = constants.%FieldBase] {} {}
|
||||
// CHECK:STDOUT: %Core.import_ref.cd6: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.ac8) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.5e0)]
|
||||
// CHECK:STDOUT: %Copy.impl_witness_table.8d2 = impl_witness_table (%Core.import_ref.cd6), @Int.as.Copy.impl [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AccessDirect(%d.param: %Derived) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @AccessDirect(%d.param: %FieldDerived) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %a.ref: %Base.elem = name_ref a, @Base.%.1 [concrete = @Base.%.1]
|
||||
// CHECK:STDOUT: %.loc8_11.1: %Base = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc8_11.2: ref %Base = class_element_access %.loc8_11.1, element0
|
||||
// CHECK:STDOUT: %.loc8_11.3: ref %Base = converted %d.ref, %.loc8_11.2
|
||||
// CHECK:STDOUT: %d.ref: %FieldDerived = name_ref d, %d
|
||||
// CHECK:STDOUT: %a.ref: %FieldBase.elem = name_ref a, @FieldBase.%.1 [concrete = @FieldBase.%.1]
|
||||
// CHECK:STDOUT: %.loc8_11.1: %FieldBase = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc8_11.2: ref %FieldBase = class_element_access %.loc8_11.1, element0
|
||||
// CHECK:STDOUT: %.loc8_11.3: ref %FieldBase = converted %d.ref, %.loc8_11.2
|
||||
// CHECK:STDOUT: %.loc8_11.4: ref %i32 = class_element_access %.loc8_11.3, element0
|
||||
// CHECK:STDOUT: %.loc8_11.5: %i32 = acquire_value %.loc8_11.4
|
||||
// CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
@@ -676,15 +676,15 @@ class V {
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @AccessQualified(%d.param: %Derived) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @AccessQualified(%d.param: %FieldDerived) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %d.ref: %FieldDerived = name_ref d, %d
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
|
||||
// CHECK:STDOUT: %b.ref: %Base.elem = name_ref b, @Base.%.2 [concrete = @Base.%.2]
|
||||
// CHECK:STDOUT: %.loc14_11.1: %Base = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc14_11.2: ref %Base = class_element_access %.loc14_11.1, element0
|
||||
// CHECK:STDOUT: %.loc14_11.3: ref %Base = converted %d.ref, %.loc14_11.2
|
||||
// CHECK:STDOUT: %FieldBase.ref: type = name_ref FieldBase, imports.%FieldBase.decl [concrete = constants.%FieldBase]
|
||||
// CHECK:STDOUT: %b.ref: %FieldBase.elem = name_ref b, @FieldBase.%.2 [concrete = @FieldBase.%.2]
|
||||
// CHECK:STDOUT: %.loc14_11.1: %FieldBase = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc14_11.2: ref %FieldBase = class_element_access %.loc14_11.1, element0
|
||||
// CHECK:STDOUT: %.loc14_11.3: ref %FieldBase = converted %d.ref, %.loc14_11.2
|
||||
// CHECK:STDOUT: %.loc14_11.4: ref %i32 = class_element_access %.loc14_11.3, element1
|
||||
// CHECK:STDOUT: %.loc14_11.5: %i32 = acquire_value %.loc14_11.4
|
||||
// CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
@@ -698,34 +698,34 @@ class V {
|
||||
// CHECK:STDOUT: --- use_base_method.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
// CHECK:STDOUT: %MethodDerived: type = class_type @MethodDerived [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
||||
// CHECK:STDOUT: %Derived.f.cpp_overload_set.type: type = cpp_overload_set_type @Derived.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Derived.f.cpp_overload_set.value: %Derived.f.cpp_overload_set.type = cpp_overload_set_value @Derived.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %MethodBase: type = class_type @MethodBase [concrete]
|
||||
// CHECK:STDOUT: %MethodDerived.f.cpp_overload_set.type: type = cpp_overload_set_type @MethodDerived.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %MethodDerived.f.cpp_overload_set.value: %MethodDerived.f.cpp_overload_set.type = cpp_overload_set_value @MethodDerived.f.cpp_overload_set [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: %Base.g.cpp_overload_set.type: type = cpp_overload_set_type @Base.g.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Base.g.cpp_overload_set.value: %Base.g.cpp_overload_set.type = cpp_overload_set_value @Base.g.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %MethodBase.g.cpp_overload_set.type: type = cpp_overload_set_type @MethodBase.g.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %MethodBase.g.cpp_overload_set.value: %MethodBase.g.cpp_overload_set.type = cpp_overload_set_value @MethodBase.g.cpp_overload_set [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: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Derived = %Derived.decl
|
||||
// CHECK:STDOUT: .Base = %Base.decl
|
||||
// CHECK:STDOUT: .MethodDerived = %MethodDerived.decl
|
||||
// CHECK:STDOUT: .MethodBase = %MethodBase.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// 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: %Derived.f.cpp_overload_set.value: %Derived.f.cpp_overload_set.type = cpp_overload_set_value @Derived.f.cpp_overload_set [concrete = constants.%Derived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %MethodDerived.decl: type = class_decl @MethodDerived [concrete = constants.%MethodDerived] {} {}
|
||||
// CHECK:STDOUT: %MethodBase.decl: type = class_decl @MethodBase [concrete = constants.%MethodBase] {} {}
|
||||
// CHECK:STDOUT: %MethodDerived.f.cpp_overload_set.value: %MethodDerived.f.cpp_overload_set.type = cpp_overload_set_value @MethodDerived.f.cpp_overload_set [concrete = constants.%MethodDerived.f.cpp_overload_set.value]
|
||||
// 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.cpp_overload_set.value: %Base.g.cpp_overload_set.type = cpp_overload_set_value @Base.g.cpp_overload_set [concrete = constants.%Base.g.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %MethodBase.g.cpp_overload_set.value: %MethodBase.g.cpp_overload_set.type = cpp_overload_set_value @MethodBase.g.cpp_overload_set [concrete = constants.%MethodBase.g.cpp_overload_set.value]
|
||||
// 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: } {
|
||||
@@ -733,50 +733,50 @@ class V {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallDirect(%d.param: %Derived) {
|
||||
// CHECK:STDOUT: fn @CallDirect(%d.param: %MethodDerived) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %f.ref: %Derived.f.cpp_overload_set.type = name_ref f, imports.%Derived.f.cpp_overload_set.value [concrete = constants.%Derived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %d.ref: %MethodDerived = name_ref d, %d
|
||||
// CHECK:STDOUT: %f.ref: %MethodDerived.f.cpp_overload_set.type = name_ref f, imports.%MethodDerived.f.cpp_overload_set.value [concrete = constants.%MethodDerived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %f.ref
|
||||
// CHECK:STDOUT: %.loc8_3.1: %Base = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc8_3.2: ref %Base = class_element_access %.loc8_3.1, element0
|
||||
// CHECK:STDOUT: %.loc8_3.3: ref %Base = converted %d.ref, %.loc8_3.2
|
||||
// CHECK:STDOUT: %.loc8_3.4: %Base = acquire_value %.loc8_3.3
|
||||
// CHECK:STDOUT: %.loc8_3.1: %MethodBase = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc8_3.2: ref %MethodBase = class_element_access %.loc8_3.1, element0
|
||||
// CHECK:STDOUT: %.loc8_3.3: ref %MethodBase = converted %d.ref, %.loc8_3.2
|
||||
// CHECK:STDOUT: %.loc8_3.4: %MethodBase = acquire_value %.loc8_3.3
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc8_3.4)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallQualified(%d.param: %Derived) {
|
||||
// CHECK:STDOUT: fn @CallQualified(%d.param: %MethodDerived) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %d.ref: %MethodDerived = name_ref d, %d
|
||||
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Base.ref: type = name_ref Base, imports.%Base.decl [concrete = constants.%Base]
|
||||
// CHECK:STDOUT: %g.ref: %Base.g.cpp_overload_set.type = name_ref g, imports.%Base.g.cpp_overload_set.value [concrete = constants.%Base.g.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %MethodBase.ref: type = name_ref MethodBase, imports.%MethodBase.decl [concrete = constants.%MethodBase]
|
||||
// CHECK:STDOUT: %g.ref: %MethodBase.g.cpp_overload_set.type = name_ref g, imports.%MethodBase.g.cpp_overload_set.value [concrete = constants.%MethodBase.g.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %d.ref, %g.ref
|
||||
// CHECK:STDOUT: %.loc14_3.1: %Base = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc14_3.2: ref %Base = class_element_access %.loc14_3.1, element0
|
||||
// CHECK:STDOUT: %.loc14_3.3: ref %Base = converted %d.ref, %.loc14_3.2
|
||||
// CHECK:STDOUT: %.loc14_3.4: %Base = acquire_value %.loc14_3.3
|
||||
// CHECK:STDOUT: %.loc14_3.1: %MethodBase = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc14_3.2: ref %MethodBase = class_element_access %.loc14_3.1, element0
|
||||
// CHECK:STDOUT: %.loc14_3.3: ref %MethodBase = converted %d.ref, %.loc14_3.2
|
||||
// CHECK:STDOUT: %.loc14_3.4: %MethodBase = acquire_value %.loc14_3.3
|
||||
// CHECK:STDOUT: %g__carbon_thunk.call: init %empty_tuple.type = call imports.%g__carbon_thunk.decl(%.loc14_3.4)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @CallBaseQualifiedByDerived(%d.param: %Derived, %b.param: %Base) {
|
||||
// CHECK:STDOUT: fn @CallBaseQualifiedByDerived(%d.param: %MethodDerived, %b.param: %MethodBase) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %d.ref: %Derived = name_ref d, %d
|
||||
// CHECK:STDOUT: %d.ref: %MethodDerived = name_ref d, %d
|
||||
// CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Derived.ref.loc23: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %f.ref.loc23: %Derived.f.cpp_overload_set.type = name_ref f, imports.%Derived.f.cpp_overload_set.value [concrete = constants.%Derived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %MethodDerived.ref.loc23: type = name_ref MethodDerived, imports.%MethodDerived.decl [concrete = constants.%MethodDerived]
|
||||
// CHECK:STDOUT: %f.ref.loc23: %MethodDerived.f.cpp_overload_set.type = name_ref f, imports.%MethodDerived.f.cpp_overload_set.value [concrete = constants.%MethodDerived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc23: <bound method> = bound_method %d.ref, %f.ref.loc23
|
||||
// CHECK:STDOUT: %.loc23_3.1: %Base = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc23_3.2: ref %Base = class_element_access %.loc23_3.1, element0
|
||||
// CHECK:STDOUT: %.loc23_3.3: ref %Base = converted %d.ref, %.loc23_3.2
|
||||
// CHECK:STDOUT: %.loc23_3.4: %Base = acquire_value %.loc23_3.3
|
||||
// CHECK:STDOUT: %.loc23_3.1: %MethodBase = as_compatible %d.ref
|
||||
// CHECK:STDOUT: %.loc23_3.2: ref %MethodBase = class_element_access %.loc23_3.1, element0
|
||||
// CHECK:STDOUT: %.loc23_3.3: ref %MethodBase = converted %d.ref, %.loc23_3.2
|
||||
// CHECK:STDOUT: %.loc23_3.4: %MethodBase = acquire_value %.loc23_3.3
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call.loc23: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%.loc23_3.4)
|
||||
// CHECK:STDOUT: %b.ref: %Base = name_ref b, %b
|
||||
// CHECK:STDOUT: %b.ref: %MethodBase = name_ref b, %b
|
||||
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, imports.%Derived.decl [concrete = constants.%Derived]
|
||||
// CHECK:STDOUT: %f.ref.loc24: %Derived.f.cpp_overload_set.type = name_ref f, imports.%Derived.f.cpp_overload_set.value [concrete = constants.%Derived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %MethodDerived.ref.loc24: type = name_ref MethodDerived, imports.%MethodDerived.decl [concrete = constants.%MethodDerived]
|
||||
// CHECK:STDOUT: %f.ref.loc24: %MethodDerived.f.cpp_overload_set.type = name_ref f, imports.%MethodDerived.f.cpp_overload_set.value [concrete = constants.%MethodDerived.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc24: <bound method> = bound_method %b.ref, %f.ref.loc24
|
||||
// CHECK:STDOUT: %f__carbon_thunk.call.loc24: init %empty_tuple.type = call imports.%f__carbon_thunk.decl(%b.ref)
|
||||
// CHECK:STDOUT: <elided>
|
||||
|
||||
+148
-148
@@ -16,7 +16,7 @@
|
||||
|
||||
// --- declaration.h
|
||||
|
||||
class Bar;
|
||||
class DeclBar;
|
||||
|
||||
// --- import_declaration.carbon
|
||||
|
||||
@@ -25,7 +25,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DeclBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// --- fail_use_declaration_as_definition.carbon
|
||||
@@ -35,15 +35,15 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration.h";
|
||||
|
||||
fn MyF() {
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `Bar` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var unused bar: Cpp.Bar;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var unused bar: Cpp.DeclBar;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class Bar;
|
||||
// CHECK:STDERR: class DeclBar;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
var unused bar: Cpp.Bar;
|
||||
var unused bar: Cpp.DeclBar;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -52,7 +52,7 @@ fn MyF() {
|
||||
|
||||
// --- definition.h
|
||||
|
||||
class Bar {};
|
||||
class DefBar {};
|
||||
|
||||
// --- import_definition.carbon
|
||||
|
||||
@@ -61,7 +61,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "definition.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DefBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
@@ -70,8 +70,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
|
||||
// --- declaration_and_definition.h
|
||||
|
||||
class Bar;
|
||||
class Bar {};
|
||||
class DeclDefBar;
|
||||
class DeclDefBar {};
|
||||
|
||||
// --- import_declaration_and_definition.carbon
|
||||
|
||||
@@ -80,7 +80,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration_and_definition.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DeclDefBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
@@ -89,7 +89,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
|
||||
// --- static_member_function.h
|
||||
|
||||
class Bar {
|
||||
class StaticMemberFnBar {
|
||||
public:
|
||||
static auto foo() -> void;
|
||||
};
|
||||
@@ -102,7 +102,7 @@ import Cpp library "static_member_function.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.Bar.foo();
|
||||
Cpp.StaticMemberFnBar.foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -112,9 +112,9 @@ fn MyF() {
|
||||
|
||||
// --- static_data_member.h
|
||||
|
||||
class Bar {
|
||||
class StaticDataMemberBar {
|
||||
public:
|
||||
static Bar* _Nonnull foo;
|
||||
static StaticDataMemberBar* _Nonnull foo;
|
||||
};
|
||||
|
||||
// --- import_static_data_member.carbon
|
||||
@@ -125,7 +125,7 @@ import Cpp library "static_data_member.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
let unused bar: Cpp.Bar* = Cpp.Bar.foo;
|
||||
let unused bar: Cpp.StaticDataMemberBar* = Cpp.StaticDataMemberBar.foo;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -135,9 +135,9 @@ fn MyF() {
|
||||
|
||||
// --- data_member.h
|
||||
|
||||
class Bar {
|
||||
class DataMemberBar {
|
||||
public:
|
||||
Bar* _Nonnull foo;
|
||||
DataMemberBar* _Nonnull foo;
|
||||
};
|
||||
|
||||
// --- import_data_member.carbon
|
||||
@@ -147,8 +147,8 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "data_member.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar : Cpp.Bar*) {
|
||||
let unused foo_bar: Cpp.Bar* = bar->foo;
|
||||
fn MyF(bar : Cpp.DataMemberBar*) {
|
||||
let unused foo_bar: Cpp.DataMemberBar* = bar->foo;
|
||||
}
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -158,9 +158,9 @@ fn MyF(bar : Cpp.Bar*) {
|
||||
|
||||
// --- dynamic.h
|
||||
|
||||
class Bar {
|
||||
class DynamicBar {
|
||||
public:
|
||||
virtual ~Bar();
|
||||
virtual ~DynamicBar();
|
||||
virtual void f();
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "dynamic.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*) {
|
||||
fn MyF(bar: Cpp.DynamicBar*) {
|
||||
bar->f();
|
||||
}
|
||||
//@dump-sem-ir-end
|
||||
@@ -182,7 +182,7 @@ fn MyF(bar: Cpp.Bar*) {
|
||||
|
||||
// --- to_inherit_public.h
|
||||
|
||||
class Bar {
|
||||
class ToInheritBar {
|
||||
public:
|
||||
static auto foo() -> void;
|
||||
};
|
||||
@@ -195,7 +195,7 @@ import Cpp library "to_inherit_public.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
class Derived {
|
||||
extend base: Cpp.Bar;
|
||||
extend base: Cpp.ToInheritBar;
|
||||
}
|
||||
|
||||
fn MyF() {
|
||||
@@ -212,7 +212,7 @@ fn MyF() {
|
||||
struct X {};
|
||||
|
||||
template<typename T>
|
||||
class Bar {};
|
||||
class TemplateBar {};
|
||||
|
||||
// --- import_template.carbon
|
||||
|
||||
@@ -221,7 +221,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "template.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
fn MyF(bar: Cpp.TemplateBar(Cpp.X)*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// --- fail_copy_witness_of_incomplete_class.carbon
|
||||
@@ -255,8 +255,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: --- import_declaration.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DeclBar: type = class_type @DeclBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -266,10 +266,10 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DeclBar = %DeclBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DeclBar.decl: type = class_decl @DeclBar [concrete = constants.%DeclBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -280,8 +280,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DeclBar.ref: type = name_ref DeclBar, imports.%DeclBar.decl [concrete = constants.%DeclBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -292,8 +292,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: --- import_definition.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DefBar: type = class_type @DefBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DefBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -303,10 +303,10 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DefBar = %DefBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DefBar.decl: type = class_decl @DefBar [concrete = constants.%DefBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -317,8 +317,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DefBar.ref: type = name_ref DefBar, imports.%DefBar.decl [concrete = constants.%DefBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DefBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -329,8 +329,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: --- import_declaration_and_definition.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DeclDefBar: type = class_type @DeclDefBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclDefBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -340,10 +340,10 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DeclDefBar = %DeclDefBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DeclDefBar.decl: type = class_decl @DeclDefBar [concrete = constants.%DeclDefBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -354,8 +354,8 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DeclDefBar.ref: type = name_ref DeclDefBar, imports.%DeclDefBar.decl [concrete = constants.%DeclDefBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclDefBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -367,38 +367,38 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.type: type = cpp_overload_set_type @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar: type = class_type @StaticMemberFnBar [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.type: type = cpp_overload_set_type @StaticMemberFnBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.value: %StaticMemberFnBar.foo.cpp_overload_set.type = cpp_overload_set_value @StaticMemberFnBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.type: type = fn_type @StaticMemberFnBar.foo [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo: %StaticMemberFnBar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .StaticMemberFnBar = %StaticMemberFnBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.decl: type = class_decl @StaticMemberFnBar [concrete = constants.%StaticMemberFnBar] {} {}
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.value: %StaticMemberFnBar.foo.cpp_overload_set.type = cpp_overload_set_value @StaticMemberFnBar.foo.cpp_overload_set [concrete = constants.%StaticMemberFnBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.decl: %StaticMemberFnBar.foo.type = fn_decl @StaticMemberFnBar.foo [concrete = constants.%StaticMemberFnBar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// 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.cpp_overload_set.type = name_ref foo, imports.%Bar.foo.cpp_overload_set.value [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.ref: type = name_ref StaticMemberFnBar, imports.%StaticMemberFnBar.decl [concrete = constants.%StaticMemberFnBar]
|
||||
// CHECK:STDOUT: %foo.ref: %StaticMemberFnBar.foo.cpp_overload_set.type = name_ref foo, imports.%StaticMemberFnBar.foo.cpp_overload_set.value [concrete = constants.%StaticMemberFnBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.call: init %empty_tuple.type = call imports.%StaticMemberFnBar.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- import_static_data_member.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr.227: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar: type = class_type @StaticDataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %ptr.a89: type = ptr_type %StaticDataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.a89 [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = value_binding_pattern bar [concrete]
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type = ref_binding_pattern foo [concrete]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type = var_pattern %foo.patt [concrete]
|
||||
@@ -406,27 +406,27 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .StaticDataMemberBar = %StaticDataMemberBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.decl: type = class_decl @StaticDataMemberBar [concrete = constants.%StaticDataMemberBar] {} {}
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type = ref_binding_pattern foo [concrete = constants.%foo.patt]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type = var_pattern %foo.patt [concrete = constants.%foo.var_patt]
|
||||
// CHECK:STDOUT: %foo.var: ref %ptr.227 = var_storage %foo.var_patt [concrete]
|
||||
// CHECK:STDOUT: %foo.var: ref %ptr.a89 = var_storage %foo.var_patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8_33: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %foo.ref: ref %ptr.227 = name_ref foo, imports.%foo.var [concrete = imports.%foo.var]
|
||||
// CHECK:STDOUT: %.loc8_37: %ptr.227 = acquire_value %foo.ref
|
||||
// CHECK:STDOUT: %.loc8_26: type = splice_block %ptr [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.ref.loc8_49: type = name_ref StaticDataMemberBar, imports.%StaticDataMemberBar.decl [concrete = constants.%StaticDataMemberBar]
|
||||
// CHECK:STDOUT: %foo.ref: ref %ptr.a89 = name_ref foo, imports.%foo.var [concrete = imports.%foo.var]
|
||||
// CHECK:STDOUT: %.loc8_69: %ptr.a89 = acquire_value %foo.ref
|
||||
// CHECK:STDOUT: %.loc8_42: type = splice_block %ptr [concrete = constants.%ptr.a89] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8_22: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref.loc8_22 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.ref.loc8_22: type = name_ref StaticDataMemberBar, imports.%StaticDataMemberBar.decl [concrete = constants.%StaticDataMemberBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %StaticDataMemberBar.ref.loc8_22 [concrete = constants.%ptr.a89]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr.227 = wrapper_binding bar, %.loc8_37
|
||||
// CHECK:STDOUT: %bar: %ptr.a89 = wrapper_binding bar, %.loc8_69
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = value_binding_pattern bar [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -436,23 +436,23 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: --- import_data_member.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr.227: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %DataMemberBar: type = class_type @DataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %ptr.ec1: type = ptr_type %DataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.ec1 [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_bar.patt: %pattern_type = value_binding_pattern foo_bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.elem: type = unbound_element_type %Bar, %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %DataMemberBar.elem: type = unbound_element_type %DataMemberBar, %ptr.ec1 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DataMemberBar = %DataMemberBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DataMemberBar.decl: type = class_decl @DataMemberBar [concrete = constants.%DataMemberBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -460,29 +460,29 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete = constants.%bar.param_patt]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.227 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr.loc7 [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.ec1 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr.loc7 [concrete = constants.%ptr.ec1] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc7: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr.loc7: type = ptr_type %Bar.ref.loc7 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %DataMemberBar.ref.loc7: type = name_ref DataMemberBar, imports.%DataMemberBar.decl [concrete = constants.%DataMemberBar]
|
||||
// CHECK:STDOUT: %ptr.loc7: type = ptr_type %DataMemberBar.ref.loc7 [concrete = constants.%ptr.ec1]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr.227 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: %bar: %ptr.ec1 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.227) {
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.ec1) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.227 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8_37.1: ref %Bar = deref %bar.ref
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.elem = name_ref foo, @Bar.%.1 [concrete = @Bar.%.1]
|
||||
// CHECK:STDOUT: %.loc8_37.2: ref %ptr.227 = class_element_access %.loc8_37.1, element0
|
||||
// CHECK:STDOUT: %.loc8_37.3: %ptr.227 = acquire_value %.loc8_37.2
|
||||
// CHECK:STDOUT: %.loc8_30: type = splice_block %ptr.loc8 [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.ec1 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8_47.1: ref %DataMemberBar = deref %bar.ref
|
||||
// CHECK:STDOUT: %foo.ref: %DataMemberBar.elem = name_ref foo, @DataMemberBar.%.1 [concrete = @DataMemberBar.%.1]
|
||||
// CHECK:STDOUT: %.loc8_47.2: ref %ptr.ec1 = class_element_access %.loc8_47.1, element0
|
||||
// CHECK:STDOUT: %.loc8_47.3: %ptr.ec1 = acquire_value %.loc8_47.2
|
||||
// CHECK:STDOUT: %.loc8_40: type = splice_block %ptr.loc8 [concrete = constants.%ptr.ec1] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr.loc8: type = ptr_type %Bar.ref.loc8 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %DataMemberBar.ref.loc8: type = name_ref DataMemberBar, imports.%DataMemberBar.decl [concrete = constants.%DataMemberBar]
|
||||
// CHECK:STDOUT: %ptr.loc8: type = ptr_type %DataMemberBar.ref.loc8 [concrete = constants.%ptr.ec1]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo_bar: %ptr.227 = wrapper_binding foo_bar, %.loc8_37.3
|
||||
// CHECK:STDOUT: %foo_bar: %ptr.ec1 = wrapper_binding foo_bar, %.loc8_47.3
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %foo_bar.patt: %pattern_type = value_binding_pattern foo_bar [concrete = constants.%foo_bar.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -492,62 +492,62 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: --- call_dynamic.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr.227: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.1b6: type = pattern_type %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type.1b6 = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type.1b6 = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
// CHECK:STDOUT: %DynamicBar: type = class_type @DynamicBar [concrete]
|
||||
// CHECK:STDOUT: %ptr.077: type = ptr_type %DynamicBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.e8d: type = pattern_type %ptr.077 [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type.e8d = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type.e8d = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.f.type: type = fn_type @Bar.f [concrete]
|
||||
// CHECK:STDOUT: %Bar.f: %Bar.f.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.f.cpp_overload_set.type: type = cpp_overload_set_type @Bar.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.f.cpp_overload_set.value: %Bar.f.cpp_overload_set.type = cpp_overload_set_value @Bar.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %DynamicBar.f.type: type = fn_type @DynamicBar.f [concrete]
|
||||
// CHECK:STDOUT: %DynamicBar.f: %DynamicBar.f.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %DynamicBar.f.cpp_overload_set.type: type = cpp_overload_set_type @DynamicBar.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %DynamicBar.f.cpp_overload_set.value: %DynamicBar.f.cpp_overload_set.type = cpp_overload_set_value @DynamicBar.f.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DynamicBar = %DynamicBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %Bar.f.decl: %Bar.f.type = fn_decl @Bar.f [concrete = constants.%Bar.f] {
|
||||
// CHECK:STDOUT: %DynamicBar.decl: type = class_decl @DynamicBar [concrete = constants.%DynamicBar] {} {}
|
||||
// CHECK:STDOUT: %DynamicBar.f.decl: %DynamicBar.f.type = fn_decl @DynamicBar.f [concrete = constants.%DynamicBar.f] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.f.cpp_overload_set.value: %Bar.f.cpp_overload_set.type = cpp_overload_set_value @Bar.f.cpp_overload_set [concrete = constants.%Bar.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %DynamicBar.f.cpp_overload_set.value: %DynamicBar.f.cpp_overload_set.type = cpp_overload_set_value @DynamicBar.f.cpp_overload_set [concrete = constants.%DynamicBar.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
// CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type.1b6 = value_param_pattern [concrete = constants.%bar.param_patt]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type.1b6 = wrapper_binding_pattern bar, %bar.param_patt [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type.e8d = value_param_pattern [concrete = constants.%bar.param_patt]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type.e8d = wrapper_binding_pattern bar, %bar.param_patt [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.227 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.077 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr.077] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %DynamicBar.ref: type = name_ref DynamicBar, imports.%DynamicBar.decl [concrete = constants.%DynamicBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DynamicBar.ref [concrete = constants.%ptr.077]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr.227 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: %bar: %ptr.077 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: vtable @Bar.vtable {
|
||||
// CHECK:STDOUT: vtable @DynamicBar.vtable {
|
||||
// CHECK:STDOUT: invalid
|
||||
// CHECK:STDOUT: invalid
|
||||
// CHECK:STDOUT: imports.%Bar.f.decl
|
||||
// CHECK:STDOUT: imports.%DynamicBar.f.decl
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.227) {
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.077) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.227 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8: ref %Bar = deref %bar.ref
|
||||
// CHECK:STDOUT: %f.ref: %Bar.f.cpp_overload_set.type = name_ref f, imports.%Bar.f.cpp_overload_set.value [concrete = constants.%Bar.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.077 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8: ref %DynamicBar = deref %bar.ref
|
||||
// CHECK:STDOUT: %f.ref: %DynamicBar.f.cpp_overload_set.type = name_ref f, imports.%DynamicBar.f.cpp_overload_set.value [concrete = constants.%DynamicBar.f.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8, %f.ref
|
||||
// CHECK:STDOUT: %Bar.f.call: init %empty_tuple.type = call imports.%Bar.f.decl(%.loc8)
|
||||
// CHECK:STDOUT: %DynamicBar.f.call: init %empty_tuple.type = call imports.%DynamicBar.f.decl(%.loc8)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -555,27 +555,27 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ToInheritBar: type = class_type @ToInheritBar [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Bar [concrete]
|
||||
// CHECK:STDOUT: %struct_type.base.825: type = struct_type {.base: %Bar} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.cb3: <witness> = complete_type_witness %struct_type.base.825 [concrete]
|
||||
// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %ToInheritBar [concrete]
|
||||
// CHECK:STDOUT: %struct_type.base.188: type = struct_type {.base: %ToInheritBar} [concrete]
|
||||
// CHECK:STDOUT: %complete_type.439: <witness> = complete_type_witness %struct_type.base.188 [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.type: type = cpp_overload_set_type @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.cpp_overload_set.type: type = cpp_overload_set_type @ToInheritBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.cpp_overload_set.value: %ToInheritBar.foo.cpp_overload_set.type = cpp_overload_set_value @ToInheritBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.type: type = fn_type @ToInheritBar.foo [concrete]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo: %ToInheritBar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .ToInheritBar = %ToInheritBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: %ToInheritBar.decl: type = class_decl @ToInheritBar [concrete = constants.%ToInheritBar] {} {}
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.cpp_overload_set.value: %ToInheritBar.foo.cpp_overload_set.type = cpp_overload_set_value @ToInheritBar.foo.cpp_overload_set [concrete = constants.%ToInheritBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.decl: %ToInheritBar.foo.type = fn_decl @ToInheritBar.foo [concrete = constants.%ToInheritBar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -585,34 +585,34 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class @Derived {
|
||||
// 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: %.loc8: %Derived.elem = base_decl %Bar.ref, element0 [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.825 [concrete = constants.%complete_type.cb3]
|
||||
// CHECK:STDOUT: %ToInheritBar.ref: type = name_ref ToInheritBar, imports.%ToInheritBar.decl [concrete = constants.%ToInheritBar]
|
||||
// CHECK:STDOUT: %.loc8: %Derived.elem = base_decl %ToInheritBar.ref, element0 [concrete]
|
||||
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.base.188 [concrete = constants.%complete_type.439]
|
||||
// CHECK:STDOUT: complete_type_witness = %complete_type
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !members:
|
||||
// CHECK:STDOUT: .Self = constants.%Derived
|
||||
// CHECK:STDOUT: .base = %.loc8
|
||||
// CHECK:STDOUT: .foo = <poisoned>
|
||||
// CHECK:STDOUT: extend %Bar.ref
|
||||
// CHECK:STDOUT: extend %ToInheritBar.ref
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// 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.cpp_overload_set.type = name_ref foo, imports.%Bar.foo.cpp_overload_set.value [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: %foo.ref: %ToInheritBar.foo.cpp_overload_set.type = name_ref foo, imports.%ToInheritBar.foo.cpp_overload_set.value [concrete = constants.%ToInheritBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ToInheritBar.foo.call: init %empty_tuple.type = call imports.%ToInheritBar.foo.decl()
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- import_template.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar.type: type = cpp_type_template_type Bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.template: %Bar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar.type: type = cpp_type_template_type TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar.template: %TemplateBar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %X: type = class_type @X [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar: type = class_type @TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -622,13 +622,13 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.template
|
||||
// CHECK:STDOUT: .TemplateBar = %TemplateBar.template
|
||||
// CHECK:STDOUT: .X = %X.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.template: %Bar.type = struct_value () [concrete = constants.%Bar.template]
|
||||
// CHECK:STDOUT: %TemplateBar.template: %TemplateBar.type = struct_value () [concrete = constants.%TemplateBar.template]
|
||||
// CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %TemplateBar.decl: type = class_decl @TemplateBar [concrete = constants.%TemplateBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -639,10 +639,10 @@ fn GenericUse(p2: Generic(Cpp.Class1)) {
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref: %Bar.type = name_ref Bar, imports.%Bar.template [concrete = constants.%Bar.template]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %TemplateBar.ref: %TemplateBar.type = name_ref TemplateBar, imports.%TemplateBar.template [concrete = constants.%TemplateBar.template]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %X.ref: type = name_ref X, imports.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type imports.%Bar.decl [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type imports.%TemplateBar.decl [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+507
-508
File diff suppressed because it is too large
Load Diff
+22
-22
@@ -93,12 +93,12 @@ fn GetF(a: Cpp.A) -> i32 { return a.f_4; }
|
||||
|
||||
// --- with_bitfields.h
|
||||
|
||||
struct Struct {
|
||||
struct BitfieldStruct {
|
||||
int a;
|
||||
int b : 2;
|
||||
};
|
||||
|
||||
union Union {
|
||||
union BitfieldUnion {
|
||||
int c;
|
||||
int d : 3;
|
||||
};
|
||||
@@ -109,13 +109,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "with_bitfields.h";
|
||||
|
||||
fn F(s: Cpp.Struct) -> i32 {
|
||||
fn F(s: Cpp.BitfieldStruct) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return s.a;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn G(s: Cpp.Union) -> i32 {
|
||||
fn G(s: Cpp.BitfieldUnion) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return s.c;
|
||||
//@dump-sem-ir-end
|
||||
@@ -131,7 +131,7 @@ library "[[@TEST_NAME]]";
|
||||
// CHECK:STDERR: ^
|
||||
import Cpp library "with_bitfields.h";
|
||||
|
||||
fn F(s: Cpp.Struct) -> i32 {
|
||||
fn F(s: Cpp.BitfieldStruct) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+8]]:10: note: in `Cpp` name lookup for `b` [InCppNameLookup]
|
||||
// CHECK:STDERR: return s.b;
|
||||
@@ -145,7 +145,7 @@ fn F(s: Cpp.Struct) -> i32 {
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn G(s: Cpp.Union) -> i32 {
|
||||
fn G(s: Cpp.BitfieldUnion) -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10: note: in `Cpp` name lookup for `d` [InCppNameLookup]
|
||||
// CHECK:STDERR: return s.d;
|
||||
@@ -405,11 +405,11 @@ fn Test(m: Cpp.UnsupportedMembers*) {
|
||||
// CHECK:STDOUT: --- use_non_bitfields_in_type_with_bitfields.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Struct: type = class_type @Struct [concrete]
|
||||
// CHECK:STDOUT: %BitfieldStruct: type = class_type @BitfieldStruct [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Struct.elem: type = unbound_element_type %Struct, %i32 [concrete]
|
||||
// CHECK:STDOUT: %BitfieldStruct.elem: type = unbound_element_type %BitfieldStruct, %i32 [concrete]
|
||||
// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.ac8: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.5e0: %Int.as.Copy.impl.Op.type.ac8 = struct_value () [symbolic]
|
||||
@@ -420,8 +420,8 @@ fn Test(m: Cpp.UnsupportedMembers*) {
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type.381: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [concrete]
|
||||
// CHECK:STDOUT: %.737: type = fn_type_with_self_type %Copy.WithSelf.Op.type.381, %Copy.facet [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.4f6, @Int.as.Copy.impl.Op(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Union: type = class_type @Union [concrete]
|
||||
// CHECK:STDOUT: %Union.elem: type = unbound_element_type %Union, %i32 [concrete]
|
||||
// CHECK:STDOUT: %BitfieldUnion: type = class_type @BitfieldUnion [concrete]
|
||||
// CHECK:STDOUT: %BitfieldUnion.elem: type = unbound_element_type %BitfieldUnion, %i32 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
@@ -429,10 +429,10 @@ fn Test(m: Cpp.UnsupportedMembers*) {
|
||||
// CHECK:STDOUT: %Copy.impl_witness_table.8d2 = impl_witness_table (%Core.import_ref.cd6), @Int.as.Copy.impl [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%s.param: %Struct) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @F(%s.param: %BitfieldStruct) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %s.ref: %Struct = name_ref s, %s
|
||||
// CHECK:STDOUT: %a.ref: %Struct.elem = name_ref a, @Struct.%.1 [concrete = @Struct.%.1]
|
||||
// CHECK:STDOUT: %s.ref: %BitfieldStruct = name_ref s, %s
|
||||
// CHECK:STDOUT: %a.ref: %BitfieldStruct.elem = name_ref a, @BitfieldStruct.%.1 [concrete = @BitfieldStruct.%.1]
|
||||
// CHECK:STDOUT: %.loc8_11.1: ref %i32 = class_element_access %s.ref, element0
|
||||
// CHECK:STDOUT: %.loc8_11.2: %i32 = acquire_value %.loc8_11.1
|
||||
// CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
@@ -443,10 +443,10 @@ fn Test(m: Cpp.UnsupportedMembers*) {
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G(%s.param: %Union) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @G(%s.param: %BitfieldUnion) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %s.ref: %Union = name_ref s, %s
|
||||
// CHECK:STDOUT: %c.ref: %Union.elem = name_ref c, @Union.%.1 [concrete = @Union.%.1]
|
||||
// CHECK:STDOUT: %s.ref: %BitfieldUnion = name_ref s, %s
|
||||
// CHECK:STDOUT: %c.ref: %BitfieldUnion.elem = name_ref c, @BitfieldUnion.%.1 [concrete = @BitfieldUnion.%.1]
|
||||
// CHECK:STDOUT: %.loc14_11.1: ref %i32 = class_element_access %s.ref, element0
|
||||
// CHECK:STDOUT: %.loc14_11.2: %i32 = acquire_value %.loc14_11.1
|
||||
// CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
@@ -460,22 +460,22 @@ fn Test(m: Cpp.UnsupportedMembers*) {
|
||||
// CHECK:STDOUT: --- fail_todo_use_bitfields.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Struct: type = class_type @Struct [concrete]
|
||||
// CHECK:STDOUT: %BitfieldStruct: type = class_type @BitfieldStruct [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Union: type = class_type @Union [concrete]
|
||||
// CHECK:STDOUT: %BitfieldUnion: type = class_type @BitfieldUnion [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F(%s.param: %Struct) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @F(%s.param: %BitfieldStruct) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %s.ref: %Struct = name_ref s, %s
|
||||
// CHECK:STDOUT: %s.ref: %BitfieldStruct = name_ref s, %s
|
||||
// CHECK:STDOUT: %b.ref: <error> = name_ref b, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G(%s.param: %Union) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: fn @G(%s.param: %BitfieldUnion) -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %s.ref: %Union = name_ref s, %s
|
||||
// CHECK:STDOUT: %s.ref: %BitfieldUnion = name_ref s, %s
|
||||
// CHECK:STDOUT: %d.ref: <error> = name_ref d, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: return <error>
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+36
-36
@@ -228,28 +228,28 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
struct ExplicitObjectParam {
|
||||
void F(this ExplicitObjectParam, _BitInt(23) x);
|
||||
struct ExplicitObjectParamUnsupported {
|
||||
void F(this ExplicitObjectParamUnsupported, _BitInt(23) x);
|
||||
};
|
||||
''';
|
||||
|
||||
fn Call(e: Cpp.ExplicitObjectParam) {
|
||||
fn Call(e: Cpp.ExplicitObjectParamUnsupported) {
|
||||
// CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
|
||||
// CHECK:STDERR: e.(Cpp.ExplicitObjectParam.F)(1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
e.(Cpp.ExplicitObjectParam.F)(1);
|
||||
e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
|
||||
}
|
||||
|
||||
// --- explicit_object_param_overloaded.h
|
||||
|
||||
struct Another {
|
||||
struct AnotherOverloaded {
|
||||
};
|
||||
|
||||
struct ExplicitObjectParam {
|
||||
void F(this ExplicitObjectParam);
|
||||
struct ExplicitObjectParamOverloaded {
|
||||
void F(this ExplicitObjectParamOverloaded);
|
||||
void F(this int);
|
||||
void F(this Another);
|
||||
void F(this AnotherOverloaded);
|
||||
};
|
||||
|
||||
// --- call_explicit_object_param_overloaded.carbon
|
||||
@@ -258,11 +258,11 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp library "explicit_object_param_overloaded.h";
|
||||
|
||||
fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
fn Call(e: Cpp.ExplicitObjectParamOverloaded, n: i32, a: Cpp.AnotherOverloaded) {
|
||||
//@dump-sem-ir-begin
|
||||
e.F();
|
||||
n.(Cpp.ExplicitObjectParam.F)();
|
||||
a.(Cpp.ExplicitObjectParam.F)();
|
||||
n.(Cpp.ExplicitObjectParamOverloaded.F)();
|
||||
a.(Cpp.ExplicitObjectParamOverloaded.F)();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -721,32 +721,32 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: --- call_explicit_object_param_overloaded.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %ExplicitObjectParam: type = class_type @ExplicitObjectParam [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded: type = class_type @ExplicitObjectParamOverloaded [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %Another: type = class_type @Another [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.cpp_overload_set.type: type = cpp_overload_set_type @ExplicitObjectParam.F.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParam.F.cpp_overload_set.value: %ExplicitObjectParam.F.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParam.F.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ptr.900: type = ptr_type %ExplicitObjectParam [concrete]
|
||||
// CHECK:STDOUT: %AnotherOverloaded: type = class_type @AnotherOverloaded [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type: type = cpp_overload_set_type @ExplicitObjectParamOverloaded.F.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.F.cpp_overload_set.value: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParamOverloaded.F.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %ptr.fb2: type = ptr_type %ExplicitObjectParamOverloaded [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.8cce43.1: type = fn_type @F__carbon_thunk.1 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.a92106.1: %F__carbon_thunk.type.8cce43.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.8cce43.2: type = fn_type @F__carbon_thunk.2 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.a92106.2: %F__carbon_thunk.type.8cce43.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ptr.bad: type = ptr_type %Another [concrete]
|
||||
// CHECK:STDOUT: %ptr.9e5: type = ptr_type %AnotherOverloaded [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.type.8cce43.3: type = fn_type @F__carbon_thunk.3 [concrete]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.a92106.3: %F__carbon_thunk.type.8cce43.3 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .ExplicitObjectParam = %ExplicitObjectParam.decl
|
||||
// CHECK:STDOUT: .Another = %Another.decl
|
||||
// CHECK:STDOUT: .ExplicitObjectParamOverloaded = %ExplicitObjectParamOverloaded.decl
|
||||
// CHECK:STDOUT: .AnotherOverloaded = %AnotherOverloaded.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// 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.cpp_overload_set.value: %ExplicitObjectParam.F.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParam.F.cpp_overload_set [concrete = constants.%ExplicitObjectParam.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.decl: type = class_decl @ExplicitObjectParamOverloaded [concrete = constants.%ExplicitObjectParamOverloaded] {} {}
|
||||
// CHECK:STDOUT: %AnotherOverloaded.decl: type = class_decl @AnotherOverloaded [concrete = constants.%AnotherOverloaded] {} {}
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.F.cpp_overload_set.value: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type = cpp_overload_set_value @ExplicitObjectParamOverloaded.F.cpp_overload_set [concrete = constants.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %F__carbon_thunk.decl.828b0d.1: %F__carbon_thunk.type.8cce43.1 = fn_decl @F__carbon_thunk.1 [concrete = constants.%F__carbon_thunk.a92106.1] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
@@ -764,27 +764,27 @@ fn Call(e: Cpp.ExplicitObjectParam, n: i32, a: Cpp.Another) {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Call(%e.param: %ExplicitObjectParam, %n.param: %i32, %a.param: %Another) {
|
||||
// CHECK:STDOUT: fn @Call(%e.param: %ExplicitObjectParamOverloaded, %n.param: %i32, %a.param: %AnotherOverloaded) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %e.ref: %ExplicitObjectParam = name_ref e, %e
|
||||
// CHECK:STDOUT: %F.ref.loc8: %ExplicitObjectParam.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParam.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParam.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %e.ref: %ExplicitObjectParamOverloaded = name_ref e, %e
|
||||
// CHECK:STDOUT: %F.ref.loc8: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %e.ref, %F.ref.loc8
|
||||
// CHECK:STDOUT: %.loc8: ref %ExplicitObjectParam = value_as_ref %e.ref
|
||||
// CHECK:STDOUT: %addr.loc8: %ptr.900 = addr_of %.loc8
|
||||
// CHECK:STDOUT: %.loc8: ref %ExplicitObjectParamOverloaded = value_as_ref %e.ref
|
||||
// CHECK:STDOUT: %addr.loc8: %ptr.fb2 = addr_of %.loc8
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.828b0d.1(%addr.loc8)
|
||||
// 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: %F.ref.loc9: %ExplicitObjectParam.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParam.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParam.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.ref.loc9: type = name_ref ExplicitObjectParamOverloaded, imports.%ExplicitObjectParamOverloaded.decl [concrete = constants.%ExplicitObjectParamOverloaded]
|
||||
// CHECK:STDOUT: %F.ref.loc9: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %n.ref, %F.ref.loc9
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.828b0d.2(%n.ref)
|
||||
// CHECK:STDOUT: %a.ref: %Another = name_ref a, %a
|
||||
// CHECK:STDOUT: %a.ref: %AnotherOverloaded = 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: %F.ref.loc10: %ExplicitObjectParam.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParam.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParam.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %ExplicitObjectParamOverloaded.ref.loc10: type = name_ref ExplicitObjectParamOverloaded, imports.%ExplicitObjectParamOverloaded.decl [concrete = constants.%ExplicitObjectParamOverloaded]
|
||||
// CHECK:STDOUT: %F.ref.loc10: %ExplicitObjectParamOverloaded.F.cpp_overload_set.type = name_ref F, imports.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value [concrete = constants.%ExplicitObjectParamOverloaded.F.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %a.ref, %F.ref.loc10
|
||||
// CHECK:STDOUT: %.loc10: ref %Another = value_as_ref %a.ref
|
||||
// CHECK:STDOUT: %addr.loc10: %ptr.bad = addr_of %.loc10
|
||||
// CHECK:STDOUT: %.loc10: ref %AnotherOverloaded = value_as_ref %a.ref
|
||||
// CHECK:STDOUT: %addr.loc10: %ptr.9e5 = addr_of %.loc10
|
||||
// CHECK:STDOUT: %F__carbon_thunk.call.loc10: init %empty_tuple.type = call imports.%F__carbon_thunk.decl.828b0d.3(%addr.loc10)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
+98
-98
@@ -16,7 +16,7 @@
|
||||
|
||||
// --- declaration.h
|
||||
|
||||
union Bar;
|
||||
union DeclBar;
|
||||
|
||||
// --- import_declaration.carbon
|
||||
|
||||
@@ -25,7 +25,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DeclBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// --- fail_use_declaration_as_definition.carbon
|
||||
@@ -35,15 +35,15 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration.h";
|
||||
|
||||
fn MyF() {
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `Bar` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var unused bar: Cpp.Bar;
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+8]]:19: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
|
||||
// CHECK:STDERR: var unused bar: Cpp.DeclBar;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: union Bar;
|
||||
// CHECK:STDERR: union DeclBar;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
var unused bar: Cpp.Bar;
|
||||
var unused bar: Cpp.DeclBar;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -52,7 +52,7 @@ fn MyF() {
|
||||
|
||||
// --- definition.h
|
||||
|
||||
union Bar {};
|
||||
union DefBar {};
|
||||
|
||||
// --- import_definition.carbon
|
||||
|
||||
@@ -61,7 +61,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "definition.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DefBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
@@ -70,8 +70,8 @@ fn MyF(bar: Cpp.Bar*);
|
||||
|
||||
// --- declaration_and_definition.h
|
||||
|
||||
union Bar;
|
||||
union Bar {};
|
||||
union DeclDefBar;
|
||||
union DeclDefBar {};
|
||||
|
||||
// --- import_declaration_and_definition.carbon
|
||||
|
||||
@@ -80,7 +80,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "declaration_and_definition.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar*);
|
||||
fn MyF(bar: Cpp.DeclDefBar*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// ============================================================================
|
||||
@@ -89,7 +89,7 @@ fn MyF(bar: Cpp.Bar*);
|
||||
|
||||
// --- static_member_function.h
|
||||
|
||||
union Bar {
|
||||
union StaticMemberFnBar {
|
||||
public:
|
||||
static auto foo() -> void;
|
||||
};
|
||||
@@ -102,7 +102,7 @@ import Cpp library "static_member_function.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.Bar.foo();
|
||||
Cpp.StaticMemberFnBar.foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -112,9 +112,9 @@ fn MyF() {
|
||||
|
||||
// --- static_data_member.h
|
||||
|
||||
union Bar {
|
||||
union StaticDataMemberBar {
|
||||
public:
|
||||
static Bar* _Nonnull foo;
|
||||
static StaticDataMemberBar* _Nonnull foo;
|
||||
};
|
||||
|
||||
// --- import_static_data_member.carbon
|
||||
@@ -125,7 +125,7 @@ import Cpp library "static_data_member.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
let unused bar: Cpp.Bar* = Cpp.Bar.foo;
|
||||
let unused bar: Cpp.StaticDataMemberBar* = Cpp.StaticDataMemberBar.foo;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -135,9 +135,9 @@ fn MyF() {
|
||||
|
||||
// --- data_member.h
|
||||
|
||||
union Bar {
|
||||
union DataMemberBar {
|
||||
public:
|
||||
Bar* _Nonnull foo;
|
||||
DataMemberBar* _Nonnull foo;
|
||||
};
|
||||
|
||||
// --- import_data_member.carbon
|
||||
@@ -147,8 +147,8 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "data_member.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar : Cpp.Bar*) {
|
||||
let unused foo_bar: Cpp.Bar* = bar->foo;
|
||||
fn MyF(bar : Cpp.DataMemberBar*) {
|
||||
let unused foo_bar: Cpp.DataMemberBar* = bar->foo;
|
||||
}
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -161,7 +161,7 @@ fn MyF(bar : Cpp.Bar*) {
|
||||
struct X {};
|
||||
|
||||
template<typename T>
|
||||
union Bar {};
|
||||
union TemplateBar {};
|
||||
|
||||
// --- import_template.carbon
|
||||
|
||||
@@ -170,14 +170,14 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "template.h";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
fn MyF(bar: Cpp.TemplateBar(Cpp.X)*);
|
||||
//@dump-sem-ir-end
|
||||
|
||||
// CHECK:STDOUT: --- import_declaration.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DeclBar: type = class_type @DeclBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -187,10 +187,10 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DeclBar = %DeclBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DeclBar.decl: type = class_decl @DeclBar [concrete = constants.%DeclBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -201,8 +201,8 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DeclBar.ref: type = name_ref DeclBar, imports.%DeclBar.decl [concrete = constants.%DeclBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -213,8 +213,8 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: --- import_definition.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DefBar: type = class_type @DefBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DefBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -224,10 +224,10 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DefBar = %DefBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DefBar.decl: type = class_decl @DefBar [concrete = constants.%DefBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -238,8 +238,8 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DefBar.ref: type = name_ref DefBar, imports.%DefBar.decl [concrete = constants.%DefBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DefBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -250,8 +250,8 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: --- import_declaration_and_definition.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %DeclDefBar: type = class_type @DeclDefBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclDefBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -261,10 +261,10 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DeclDefBar = %DeclDefBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DeclDefBar.decl: type = class_decl @DeclDefBar [concrete = constants.%DeclDefBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -275,8 +275,8 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// 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: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %DeclDefBar.ref: type = name_ref DeclDefBar, imports.%DeclDefBar.decl [concrete = constants.%DeclDefBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %DeclDefBar.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
@@ -288,38 +288,38 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.type: type = cpp_overload_set_type @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo.type: type = fn_type @Bar.foo [concrete]
|
||||
// CHECK:STDOUT: %Bar.foo: %Bar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar: type = class_type @StaticMemberFnBar [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.type: type = cpp_overload_set_type @StaticMemberFnBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.value: %StaticMemberFnBar.foo.cpp_overload_set.type = cpp_overload_set_value @StaticMemberFnBar.foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.type: type = fn_type @StaticMemberFnBar.foo [concrete]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo: %StaticMemberFnBar.foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .StaticMemberFnBar = %StaticMemberFnBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %Bar.foo.cpp_overload_set.value: %Bar.foo.cpp_overload_set.type = cpp_overload_set_value @Bar.foo.cpp_overload_set [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.decl: %Bar.foo.type = fn_decl @Bar.foo [concrete = constants.%Bar.foo] {} {}
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.decl: type = class_decl @StaticMemberFnBar [concrete = constants.%StaticMemberFnBar] {} {}
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.cpp_overload_set.value: %StaticMemberFnBar.foo.cpp_overload_set.type = cpp_overload_set_value @StaticMemberFnBar.foo.cpp_overload_set [concrete = constants.%StaticMemberFnBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.decl: %StaticMemberFnBar.foo.type = fn_decl @StaticMemberFnBar.foo [concrete = constants.%StaticMemberFnBar.foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// 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.cpp_overload_set.type = name_ref foo, imports.%Bar.foo.cpp_overload_set.value [concrete = constants.%Bar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Bar.foo.call: init %empty_tuple.type = call imports.%Bar.foo.decl()
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.ref: type = name_ref StaticMemberFnBar, imports.%StaticMemberFnBar.decl [concrete = constants.%StaticMemberFnBar]
|
||||
// CHECK:STDOUT: %foo.ref: %StaticMemberFnBar.foo.cpp_overload_set.type = name_ref foo, imports.%StaticMemberFnBar.foo.cpp_overload_set.value [concrete = constants.%StaticMemberFnBar.foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %StaticMemberFnBar.foo.call: init %empty_tuple.type = call imports.%StaticMemberFnBar.foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- import_static_data_member.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr.227: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar: type = class_type @StaticDataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %ptr.a89: type = ptr_type %StaticDataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.a89 [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = value_binding_pattern bar [concrete]
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type = ref_binding_pattern foo [concrete]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type = var_pattern %foo.patt [concrete]
|
||||
@@ -327,27 +327,27 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .StaticDataMemberBar = %StaticDataMemberBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.decl: type = class_decl @StaticDataMemberBar [concrete = constants.%StaticDataMemberBar] {} {}
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type = ref_binding_pattern foo [concrete = constants.%foo.patt]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type = var_pattern %foo.patt [concrete = constants.%foo.var_patt]
|
||||
// CHECK:STDOUT: %foo.var: ref %ptr.227 = var_storage %foo.var_patt [concrete]
|
||||
// CHECK:STDOUT: %foo.var: ref %ptr.a89 = var_storage %foo.var_patt [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8_33: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %foo.ref: ref %ptr.227 = name_ref foo, imports.%foo.var [concrete = imports.%foo.var]
|
||||
// CHECK:STDOUT: %.loc8_37: %ptr.227 = acquire_value %foo.ref
|
||||
// CHECK:STDOUT: %.loc8_26: type = splice_block %ptr [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.ref.loc8_49: type = name_ref StaticDataMemberBar, imports.%StaticDataMemberBar.decl [concrete = constants.%StaticDataMemberBar]
|
||||
// CHECK:STDOUT: %foo.ref: ref %ptr.a89 = name_ref foo, imports.%foo.var [concrete = imports.%foo.var]
|
||||
// CHECK:STDOUT: %.loc8_69: %ptr.a89 = acquire_value %foo.ref
|
||||
// CHECK:STDOUT: %.loc8_42: type = splice_block %ptr [concrete = constants.%ptr.a89] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8_22: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref.loc8_22 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %StaticDataMemberBar.ref.loc8_22: type = name_ref StaticDataMemberBar, imports.%StaticDataMemberBar.decl [concrete = constants.%StaticDataMemberBar]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %StaticDataMemberBar.ref.loc8_22 [concrete = constants.%ptr.a89]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr.227 = wrapper_binding bar, %.loc8_37
|
||||
// CHECK:STDOUT: %bar: %ptr.a89 = wrapper_binding bar, %.loc8_69
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = value_binding_pattern bar [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -357,23 +357,23 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: --- import_data_member.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr.227: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %DataMemberBar: type = class_type @DataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %ptr.ec1: type = ptr_type %DataMemberBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr.ec1 [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
// CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
|
||||
// CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_bar.patt: %pattern_type = value_binding_pattern foo_bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.elem: type = unbound_element_type %Bar, %ptr.227 [concrete]
|
||||
// CHECK:STDOUT: %DataMemberBar.elem: type = unbound_element_type %DataMemberBar, %ptr.ec1 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.decl
|
||||
// CHECK:STDOUT: .DataMemberBar = %DataMemberBar.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %DataMemberBar.decl: type = class_decl @DataMemberBar [concrete = constants.%DataMemberBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -381,29 +381,29 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete = constants.%bar.param_patt]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete = constants.%bar.patt]
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.227 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr.loc7 [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %bar.param: %ptr.ec1 = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr.loc7 [concrete = constants.%ptr.ec1] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc7: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr.loc7: type = ptr_type %Bar.ref.loc7 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %DataMemberBar.ref.loc7: type = name_ref DataMemberBar, imports.%DataMemberBar.decl [concrete = constants.%DataMemberBar]
|
||||
// CHECK:STDOUT: %ptr.loc7: type = ptr_type %DataMemberBar.ref.loc7 [concrete = constants.%ptr.ec1]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr.227 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: %bar: %ptr.ec1 = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.227) {
|
||||
// CHECK:STDOUT: fn @MyF(%bar.param: %ptr.ec1) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.227 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8_37.1: ref %Bar = deref %bar.ref
|
||||
// CHECK:STDOUT: %foo.ref: %Bar.elem = name_ref foo, @Bar.%.1 [concrete = @Bar.%.1]
|
||||
// CHECK:STDOUT: %.loc8_37.2: ref %ptr.227 = class_element_access %.loc8_37.1, element0
|
||||
// CHECK:STDOUT: %.loc8_37.3: %ptr.227 = acquire_value %.loc8_37.2
|
||||
// CHECK:STDOUT: %.loc8_30: type = splice_block %ptr.loc8 [concrete = constants.%ptr.227] {
|
||||
// CHECK:STDOUT: %bar.ref: %ptr.ec1 = name_ref bar, %bar
|
||||
// CHECK:STDOUT: %.loc8_47.1: ref %DataMemberBar = deref %bar.ref
|
||||
// CHECK:STDOUT: %foo.ref: %DataMemberBar.elem = name_ref foo, @DataMemberBar.%.1 [concrete = @DataMemberBar.%.1]
|
||||
// CHECK:STDOUT: %.loc8_47.2: ref %ptr.ec1 = class_element_access %.loc8_47.1, element0
|
||||
// CHECK:STDOUT: %.loc8_47.3: %ptr.ec1 = acquire_value %.loc8_47.2
|
||||
// CHECK:STDOUT: %.loc8_40: type = splice_block %ptr.loc8 [concrete = constants.%ptr.ec1] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref.loc8: type = name_ref Bar, imports.%Bar.decl [concrete = constants.%Bar]
|
||||
// CHECK:STDOUT: %ptr.loc8: type = ptr_type %Bar.ref.loc8 [concrete = constants.%ptr.227]
|
||||
// CHECK:STDOUT: %DataMemberBar.ref.loc8: type = name_ref DataMemberBar, imports.%DataMemberBar.decl [concrete = constants.%DataMemberBar]
|
||||
// CHECK:STDOUT: %ptr.loc8: type = ptr_type %DataMemberBar.ref.loc8 [concrete = constants.%ptr.ec1]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo_bar: %ptr.227 = wrapper_binding foo_bar, %.loc8_37.3
|
||||
// CHECK:STDOUT: %foo_bar: %ptr.ec1 = wrapper_binding foo_bar, %.loc8_47.3
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %foo_bar.patt: %pattern_type = value_binding_pattern foo_bar [concrete = constants.%foo_bar.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -413,11 +413,11 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: --- import_template.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %Bar.type: type = cpp_type_template_type Bar [concrete]
|
||||
// CHECK:STDOUT: %Bar.template: %Bar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar.type: type = cpp_type_template_type TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar.template: %TemplateBar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %X: type = class_type @X [concrete]
|
||||
// CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
|
||||
// CHECK:STDOUT: %TemplateBar: type = class_type @TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %TemplateBar [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %bar.param_patt: %pattern_type = value_param_pattern [concrete]
|
||||
// CHECK:STDOUT: %bar.patt: %pattern_type = wrapper_binding_pattern bar, %bar.param_patt [concrete]
|
||||
@@ -427,13 +427,13 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .Bar = %Bar.template
|
||||
// CHECK:STDOUT: .TemplateBar = %TemplateBar.template
|
||||
// CHECK:STDOUT: .X = %X.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Bar.template: %Bar.type = struct_value () [concrete = constants.%Bar.template]
|
||||
// CHECK:STDOUT: %TemplateBar.template: %TemplateBar.type = struct_value () [concrete = constants.%TemplateBar.template]
|
||||
// CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
|
||||
// CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
|
||||
// CHECK:STDOUT: %TemplateBar.decl: type = class_decl @TemplateBar [concrete = constants.%TemplateBar] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: file {
|
||||
@@ -444,10 +444,10 @@ fn MyF(bar: Cpp.Bar(Cpp.X)*);
|
||||
// CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
|
||||
// CHECK:STDOUT: %.loc7: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Bar.ref: %Bar.type = name_ref Bar, imports.%Bar.template [concrete = constants.%Bar.template]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %TemplateBar.ref: %TemplateBar.type = name_ref TemplateBar, imports.%TemplateBar.template [concrete = constants.%TemplateBar.template]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc7_29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %X.ref: type = name_ref X, imports.%X.decl [concrete = constants.%X]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type imports.%Bar.decl [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type imports.%TemplateBar.decl [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar: %ptr = wrapper_binding bar, %bar.param
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
@@ -15,19 +15,19 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
fn F(a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
fn FArrayValueParam(a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
|
||||
inline Cpp '''
|
||||
int G() {
|
||||
int GArrayValueParam() {
|
||||
int arr[5];
|
||||
//@dump-sem-ir-begin
|
||||
return Carbon::F(arr);
|
||||
return Carbon::FArrayValueParam(arr);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
int H() {
|
||||
int HArrayValueParam() {
|
||||
//@dump-sem-ir-begin
|
||||
return Carbon::F({1, 2, 3, 4, 5});
|
||||
return Carbon::FArrayValueParam({1, 2, 3, 4, 5});
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
''';
|
||||
@@ -44,23 +44,34 @@ import Cpp;
|
||||
|
||||
// TODO: These diagnostics are very bad.
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+8]]:1: error: semantics TODO: `by-var array parameter` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to map C++ type to Carbon` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
|
||||
|
||||
inline Cpp '''
|
||||
int G() {
|
||||
int GArrayVarParam() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:18: error: no member named 'F' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 28 | return Carbon::F({1, 2, 3, 4, 5});
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+15]]:10: error: no member named 'FArrayVarParam' in namespace 'Carbon'; did you mean 'GArrayVarParam'? [CppInteropParseError]
|
||||
// CHECK:STDERR: 39 | return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: | GArrayVarParam
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-6]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 22 | int GArrayVarParam() {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
return Carbon::F({1, 2, 3, 4, 5});
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+7]]:33: error: too many arguments to function call, expected 0, have 1 [CppInteropParseError]
|
||||
// CHECK:STDERR: 39 | return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
|
||||
// CHECK:STDERR: | ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-13]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 22 | int GArrayVarParam() {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
''';
|
||||
@@ -75,20 +86,28 @@ import Cpp;
|
||||
// TODO: Support this, perhaps by returning a `std::array`.
|
||||
|
||||
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:1: error: semantics TODO: `array return type` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F() -> array(i32, 5) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn FArrayReturn() -> array(i32, 5) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F() -> array(i32, 5) {
|
||||
fn FArrayReturn() -> array(i32, 5) {
|
||||
return (1, 2, 3, 4, 5);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
int G() {
|
||||
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:24: error: no member named 'F' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | auto &&arr = Carbon::F();
|
||||
// CHECK:STDERR: | ^
|
||||
int GArrayReturn() {
|
||||
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+8]]:16: error: no member named 'FArrayReturn' in namespace 'Carbon'; did you mean 'GArrayReturn'? [CppInteropParseError]
|
||||
// CHECK:STDERR: 27 | auto &&arr = Carbon::FArrayReturn();
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: | GArrayReturn
|
||||
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE-5]]:5: note: 'GArrayReturn' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 18 | int GArrayReturn() {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
auto &&arr = Carbon::FArrayReturn();
|
||||
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:13: error: subscripted value is not an array, pointer, or vector [CppInteropParseError]
|
||||
// CHECK:STDERR: 32 | return arr[0];
|
||||
// CHECK:STDERR: | ~~~^~
|
||||
// CHECK:STDERR:
|
||||
auto &&arr = Carbon::F();
|
||||
return arr[0];
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -20,7 +20,7 @@ class OneArg {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
void CallOneArg() {
|
||||
Carbon::OneArg a(42);
|
||||
}
|
||||
''';
|
||||
@@ -30,26 +30,26 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class OneArg {
|
||||
fn OneArg(self, i: i32) -> Self;
|
||||
class FactoryIsMethod {
|
||||
fn FactoryIsMethod(self, i: i32) -> Self;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+13]]:18: error: no matching constructor for initialization of 'Carbon::OneArg' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::OneArg a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:14: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-12]]:14: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-15]]:14: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
void CallFactoryIsMethod() {
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+13]]:27: error: no matching constructor for initialization of 'Carbon::FactoryIsMethod' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::FactoryIsMethod a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryIsMethod' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryIsMethod {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-12]]:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryIsMethod' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryIsMethod {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-15]]:23: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryIsMethod {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::OneArg a(42);
|
||||
Carbon::FactoryIsMethod a(42);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -58,26 +58,26 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class OneArg {
|
||||
fn OneArg(i: i32) -> i32;
|
||||
class FactoryDoesntReturnSelf {
|
||||
fn FactoryDoesntReturnSelf(i: i32) -> i32;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+13]]:18: error: no matching constructor for initialization of 'Carbon::OneArg' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::OneArg a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:14: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-12]]:14: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-15]]:14: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
void CallFactoryDoesntReturnSelf() {
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+13]]:35: error: no matching constructor for initialization of 'Carbon::FactoryDoesntReturnSelf' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::FactoryDoesntReturnSelf a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryDoesntReturnSelf {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-12]]:31: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryDoesntReturnSelf {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-15]]:31: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryDoesntReturnSelf {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::OneArg a(42);
|
||||
Carbon::FactoryDoesntReturnSelf a(42);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -86,26 +86,26 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class OneArg {
|
||||
fn OneArg(i: i32) -> ref Self;
|
||||
class FactoryReturnsByRef {
|
||||
fn FactoryReturnsByRef(i: i32) -> ref Self;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+13]]:18: error: no matching constructor for initialization of 'Carbon::OneArg' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::OneArg a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:14: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-12]]:14: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'OneArg' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-15]]:14: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class OneArg {
|
||||
// CHECK:STDERR: | ^
|
||||
void CallFactoryReturnsByRef() {
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+13]]:31: error: no matching constructor for initialization of 'Carbon::FactoryReturnsByRef' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::FactoryReturnsByRef a(42);
|
||||
// CHECK:STDERR: | ^ ~~
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:27: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryReturnsByRef' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryReturnsByRef {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-12]]:27: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryReturnsByRef' for 1st argument [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryReturnsByRef {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-15]]:27: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FactoryReturnsByRef {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::OneArg a(42);
|
||||
Carbon::FactoryReturnsByRef a(42);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -125,7 +125,7 @@ class GenericConstructor {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
void CallGenericConstructor() {
|
||||
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+13]]:30: error: no matching constructor for initialization of 'Carbon::GenericConstructor' [CppInteropParseError]
|
||||
// CHECK:STDERR: 30 | Carbon::GenericConstructor b(0);
|
||||
// CHECK:STDERR: | ^ ~
|
||||
@@ -159,7 +159,7 @@ class GenericClass(T: type) {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
void CallGenericClass() {
|
||||
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+13]]:29: error: no matching constructor for initialization of 'Carbon::GenericClass<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR: 30 | Carbon::GenericClass<int> c(0);
|
||||
// CHECK:STDERR: | ^ ~
|
||||
|
||||
@@ -10,46 +10,51 @@
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/export/function.carbon
|
||||
|
||||
// --- other.carbon
|
||||
// --- other_function.carbon
|
||||
|
||||
package Other;
|
||||
package OtherFunction;
|
||||
fn F1() {}
|
||||
fn F2() -> i32 { return 0; }
|
||||
fn F3(_: i32) {}
|
||||
|
||||
fn HasGenericArg(generic T: type, a: T) { a; }
|
||||
fn HasDeducedArg[T: type](a: T) { a; }
|
||||
|
||||
// --- function.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Other;
|
||||
import OtherFunction;
|
||||
import Cpp inline '''
|
||||
void G() {
|
||||
Carbon::Other::F1();
|
||||
void CallF1() {
|
||||
Carbon::OtherFunction::F1();
|
||||
}
|
||||
''';
|
||||
|
||||
// --- other_return_int.carbon
|
||||
|
||||
package OtherReturnInt;
|
||||
fn F2() -> i32 { return 0; }
|
||||
|
||||
// --- return_int.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Other;
|
||||
import OtherReturnInt;
|
||||
import Cpp inline '''
|
||||
int G() {
|
||||
return Carbon::Other::F2();
|
||||
int CallF2() {
|
||||
return Carbon::OtherReturnInt::F2();
|
||||
}
|
||||
''';
|
||||
|
||||
// --- other_args.carbon
|
||||
|
||||
package OtherArgs;
|
||||
fn F3(_: i32) {}
|
||||
|
||||
// --- args.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Other;
|
||||
import OtherArgs;
|
||||
import Cpp inline '''
|
||||
void G() {
|
||||
Carbon::Other::F3(123);
|
||||
void CallF3() {
|
||||
Carbon::OtherArgs::F3(123);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -59,12 +64,12 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
fn F(ref n: i32);
|
||||
fn RefF(ref n: i32);
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
void CallRefF() {
|
||||
int n = 0;
|
||||
Carbon::F(n);
|
||||
Carbon::RefF(n);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -74,40 +79,50 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
fn F();
|
||||
fn UsingF();
|
||||
|
||||
inline Cpp '''
|
||||
using Carbon::F;
|
||||
void G() { F(); }
|
||||
using Carbon::UsingF;
|
||||
void CallUsingF() { UsingF(); }
|
||||
''';
|
||||
|
||||
// --- other_generic.carbon
|
||||
|
||||
package OtherGeneric;
|
||||
fn HasGenericArg(generic T: type, a: T) { a; }
|
||||
|
||||
// --- fail_todo_generic.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+9]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other.carbon:7:1: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: other_generic.carbon:3:1: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
|
||||
// CHECK:STDERR: fn HasGenericArg(generic T: type, a: T) { a; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+5]]:1: in import [InImport]
|
||||
// CHECK:STDERR: other.carbon:7:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: other_generic.carbon:3:1: note: calling function declared here [InCallToEntity]
|
||||
// CHECK:STDERR: fn HasGenericArg(generic T: type, a: T) { a; }
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
import Other;
|
||||
import OtherGeneric;
|
||||
import Cpp inline '''
|
||||
void G() {
|
||||
Carbon::Other::HasGenericArg<int>(123);
|
||||
void CallHasGenericArg() {
|
||||
Carbon::OtherGeneric::HasGenericArg<int>(123);
|
||||
}
|
||||
''';
|
||||
|
||||
// --- other_deduced.carbon
|
||||
|
||||
package OtherDeduced;
|
||||
fn HasDeducedArg[T: type](a: T) { a; }
|
||||
|
||||
// --- deduced.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Other;
|
||||
import OtherDeduced;
|
||||
import Cpp inline '''
|
||||
void G() {
|
||||
Carbon::Other::HasDeducedArg(123);
|
||||
void CallHasDeducedArg() {
|
||||
Carbon::OtherDeduced::HasDeducedArg(123);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -39,7 +39,7 @@ fn F[T: I](t: T) -> T {
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
Carbon::B G() {
|
||||
Carbon::B CallInterfaceF() {
|
||||
Carbon::A a;
|
||||
Carbon::B b;
|
||||
Carbon::F(a);
|
||||
@@ -53,22 +53,22 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:1: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F[unused N: i32]() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn NonTypeF[unused N: i32]() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F[unused N: i32]() {}
|
||||
fn NonTypeF[unused N: i32]() {}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+8]]:11: error: no member named 'F' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::F<3>();
|
||||
// CHECK:STDERR: | ^
|
||||
void CallNonTypeF() {
|
||||
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+8]]:11: error: no member named 'NonTypeF' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::NonTypeF<3>();
|
||||
// CHECK:STDERR: | ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:16: error: expected expression [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::F<3>();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:23: error: expected expression [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::NonTypeF<3>();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::F<3>();
|
||||
Carbon::NonTypeF<3>();
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -76,13 +76,13 @@ void G() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
fn F[T: type](unused t: T*) {}
|
||||
fn PointerF[T: type](unused t: T*) {}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
void CallPointerF() {
|
||||
int x = 0;
|
||||
int* _Nonnull p = &x;
|
||||
Carbon::F(p);
|
||||
Carbon::PointerF(p);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -90,26 +90,26 @@ void G() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class A(T: type) {
|
||||
class EnclosingA(T: type) {
|
||||
// CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F[U: type](x: T, y: U);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn MemberF[U: type](x: T, y: U);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F[U: type](x: T, y: U);
|
||||
fn MemberF[U: type](x: T, y: U);
|
||||
}
|
||||
alias B = A(i32);
|
||||
alias EnclosingB = EnclosingA(i32);
|
||||
|
||||
inline Cpp '''
|
||||
void f() {
|
||||
// TODO: this currently fails because `B` can't be imported, but the intent
|
||||
void CallEnclosingF() {
|
||||
// TODO: this currently fails because `EnclosingB` can't be imported, but the intent
|
||||
// is to test a generic function within an enclosing generic scope.
|
||||
//
|
||||
Carbon::B b;
|
||||
// CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+4]]:5: error: no member named 'F' in 'Carbon::A<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | b.F(1, 2);
|
||||
Carbon::EnclosingB b;
|
||||
// CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+4]]:5: error: no member named 'MemberF' in 'Carbon::EnclosingA<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | b.MemberF(1, 2);
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR:
|
||||
b.F(1, 2);
|
||||
b.MemberF(1, 2);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -118,22 +118,22 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to import C++ type` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn F[T: type](unused t: T) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fn UnsupportedF[T: type](unused t: T) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
fn F[T: type](unused t: T) {}
|
||||
fn UnsupportedF[T: type](unused t: T) {}
|
||||
|
||||
inline Cpp '''
|
||||
void G() {
|
||||
void CallUnsupportedF() {
|
||||
volatile int x;
|
||||
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+7]]:3: error: no matching function for call to 'F' [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::F(x);
|
||||
// CHECK:STDERR: | ^~~~~~~~~
|
||||
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-8]]:28: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote]
|
||||
// CHECK:STDERR: 8 | fn F[T: type](unused t: T) {}
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+7]]:3: error: no matching function for call to 'UnsupportedF' [CppInteropParseError]
|
||||
// CHECK:STDERR: 20 | Carbon::UnsupportedF(x);
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-8]]:39: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote]
|
||||
// CHECK:STDERR: 8 | fn UnsupportedF[T: type](unused t: T) {}
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Carbon::F(x);
|
||||
Carbon::UnsupportedF(x);
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -274,7 +274,7 @@ void G() {
|
||||
// CHECK:STDOUT: %.loc24_23.1: %I.type = converted %A.decl, %I.facet.loc24_23.1 [concrete = constants.%I.facet.f31]
|
||||
// CHECK:STDOUT: %I.facet.loc24_23.2: %I.type = facet_value %B.decl, (constants.%I.impl_witness.b14) [concrete = constants.%I.facet.a68]
|
||||
// CHECK:STDOUT: %.loc24_23.2: %I.type = converted %B.decl, %I.facet.loc24_23.2 [concrete = constants.%I.facet.a68]
|
||||
// CHECK:STDOUT: inline_cpp "Carbon::B G() {\n Carbon::A a;\n Carbon::B b;\n Carbon::F(a);\n return Carbon::F(b);\n}\n"
|
||||
// CHECK:STDOUT: inline_cpp "Carbon::B CallInterfaceF() {\n Carbon::A a;\n Carbon::B b;\n Carbon::F(a);\n return Carbon::F(b);\n}\n"
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: interface @I {
|
||||
|
||||
+466
-466
File diff suppressed because it is too large
Load Diff
@@ -16,41 +16,41 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr int f(int a, int b) { return a + b; }
|
||||
constexpr int add(int a, int b) { return a + b; }
|
||||
''';
|
||||
|
||||
let a: array(i32, Cpp.f(1, 2)) = (1, 2, 3);
|
||||
let a: array(i32, Cpp.add(1, 2)) = (1, 2, 3);
|
||||
|
||||
// --- bool_param.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr int f(bool b) {
|
||||
constexpr int bool_fn(bool b) {
|
||||
return b ? 3 : 0;
|
||||
}
|
||||
''';
|
||||
|
||||
let a: array(i32, Cpp.f(true)) = (1, 2, 3);
|
||||
let a: array(i32, Cpp.bool_fn(true)) = (1, 2, 3);
|
||||
|
||||
// --- float_param.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr int f(float b) {
|
||||
constexpr int float_fn(float b) {
|
||||
return static_cast<int>(b);
|
||||
}
|
||||
''';
|
||||
|
||||
let a: array(i32, Cpp.f(3.0)) = (1, 2, 3);
|
||||
let a: array(i32, Cpp.float_fn(3.0)) = (1, 2, 3);
|
||||
|
||||
// --- return_bool.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr bool f() {
|
||||
constexpr bool return_bool_fn() {
|
||||
return true;
|
||||
}
|
||||
''';
|
||||
@@ -59,7 +59,7 @@ musteval fn F(b: bool) -> i32 {
|
||||
return if b then 3 else 0;
|
||||
}
|
||||
|
||||
let a: array(i32, F(Cpp.f())) = (1, 2, 3);
|
||||
let a: array(i32, F(Cpp.return_bool_fn())) = (1, 2, 3);
|
||||
|
||||
// --- fail_invalid_constant_eval.carbon
|
||||
|
||||
@@ -67,16 +67,16 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr int arr[1] = {0};
|
||||
constexpr int f(int a) {
|
||||
constexpr int invalid_const_fn(int a) {
|
||||
return arr[a];
|
||||
}
|
||||
''';
|
||||
|
||||
// CHECK:STDERR: fail_invalid_constant_eval.carbon:[[@LINE+4]]:19: error: array bound is not a constant [InvalidArrayExpr]
|
||||
// CHECK:STDERR: let a: array(i32, Cpp.f(5)) = (1, 2, 3);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let a: array(i32, Cpp.f(5)) = (1, 2, 3);
|
||||
let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3);
|
||||
|
||||
// --- nonconstant_constexpr_call.carbon
|
||||
|
||||
@@ -87,11 +87,11 @@ import Cpp;
|
||||
var a: i32 = 0;
|
||||
|
||||
inline Cpp '''
|
||||
constexpr int f(const int &r) { return r; }
|
||||
constexpr int nonconst_constexpr_fn(const int &r) { return r; }
|
||||
''';
|
||||
|
||||
// OK, runtime call.
|
||||
var b: i32 = Cpp.f(a);
|
||||
var b: i32 = Cpp.nonconst_constexpr_fn(a);
|
||||
|
||||
// --- fail_nonconstant_consteval_call.carbon
|
||||
|
||||
@@ -103,30 +103,30 @@ var a: i32 = 0;
|
||||
|
||||
// TODO: This is failing when building the thunk, not when calling it.
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+9]]:15: error: call to consteval function 'f' is not a constant expression [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | consteval int f(const int &r) { return r; }
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+9]]:15: error: call to consteval function 'nonconst_consteval_fn' is not a constant expression [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; }
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+6]]:15: note: function parameter 'r' with unknown value cannot be used in a constant expression [CppInteropParseNote]
|
||||
// CHECK:STDERR: 19 | consteval int f(const int &r) { return r; }
|
||||
// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; }
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:15: note: declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 19 | consteval int f(const int &r) { return r; }
|
||||
// CHECK:STDERR: 19 | consteval int nonconst_consteval_fn(const int &r) { return r; }
|
||||
// CHECK:STDERR: | ^
|
||||
consteval int f(const int &r) { return r; }
|
||||
consteval int nonconst_consteval_fn(const int &r) { return r; }
|
||||
''';
|
||||
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+11]]:14: note: in thunk for C++ function used here [InCppThunk]
|
||||
// CHECK:STDERR: var b: i32 = Cpp.f(a);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+7]]:14: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
|
||||
// CHECK:STDERR: var b: i32 = Cpp.f(a);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: var b: i32 = Cpp.nonconst_consteval_fn(a);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE-10]]:15: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
|
||||
// CHECK:STDERR: consteval int f(const int &r) { return r; }
|
||||
// CHECK:STDERR: consteval int nonconst_consteval_fn(const int &r) { return r; }
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
var b: i32 = Cpp.f(a);
|
||||
var b: i32 = Cpp.nonconst_consteval_fn(a);
|
||||
|
||||
// --- fail_todo_constructor.carbon
|
||||
|
||||
@@ -135,8 +135,8 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
inline Cpp '''
|
||||
struct C {
|
||||
constexpr C(int a) : a(a) {}
|
||||
struct ConstexprC {
|
||||
constexpr ConstexprC(int a) : a(a) {}
|
||||
int a;
|
||||
};
|
||||
''';
|
||||
@@ -144,10 +144,10 @@ struct C {
|
||||
// TODO: This should probably be allowed.
|
||||
eval fn F() -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+3]]:18: error: expression is runtime; expected constant [EvalRequiresConstantValue]
|
||||
// CHECK:STDERR: let c: Cpp.C = 3;
|
||||
// CHECK:STDERR: ^
|
||||
let c: Cpp.C = 3;
|
||||
// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+3]]:27: error: expression is runtime; expected constant [EvalRequiresConstantValue]
|
||||
// CHECK:STDERR: let c: Cpp.ConstexprC = 3;
|
||||
// CHECK:STDERR: ^
|
||||
let c: Cpp.ConstexprC = 3;
|
||||
return c.a;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
@@ -165,14 +165,14 @@ let a: array(i32, F()) = (1, 2, 3);
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
||||
// CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %i32 [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.bbc: type = pattern_type %C [concrete]
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.bbc = value_binding_pattern c [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC: type = class_type @ConstexprC [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC.elem: type = unbound_element_type %ConstexprC, %i32 [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.3cc: type = pattern_type %ConstexprC [concrete]
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.3cc = value_binding_pattern c [concrete]
|
||||
// CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
|
||||
// CHECK:STDOUT: %ptr.0a2: 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: %ptr.0b8: type = ptr_type %ConstexprC [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC__carbon_thunk.type: type = fn_type @ConstexprC__carbon_thunk [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC__carbon_thunk: %ConstexprC__carbon_thunk.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.914: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e74: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl.0e9(%To) [symbolic]
|
||||
@@ -197,19 +197,19 @@ let a: array(i32, F()) = (1, 2, 3);
|
||||
// CHECK:STDOUT: %Copy.WithSelf.Op.type.381: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [concrete]
|
||||
// CHECK:STDOUT: %.737: type = fn_type_with_self_type %Copy.WithSelf.Op.type.381, %Copy.facet [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.4f6, @Int.as.Copy.impl.Op(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %C.cpp_destructor.type: type = fn_type @C.cpp_destructor [concrete]
|
||||
// CHECK:STDOUT: %C.cpp_destructor: %C.cpp_destructor.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %C.Op.type: type = fn_type @C.Op [concrete]
|
||||
// CHECK:STDOUT: %C.Op: %C.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC.cpp_destructor.type: type = fn_type @ConstexprC.cpp_destructor [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC.cpp_destructor: %ConstexprC.cpp_destructor.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC.Op.type: type = fn_type @ConstexprC.Op [concrete]
|
||||
// CHECK:STDOUT: %ConstexprC.Op: %ConstexprC.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .C = %C.decl
|
||||
// CHECK:STDOUT: .ConstexprC = %ConstexprC.decl
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
||||
// CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
|
||||
// CHECK:STDOUT: %ConstexprC.decl: type = class_decl @ConstexprC [concrete = constants.%ConstexprC] {} {}
|
||||
// CHECK:STDOUT: %ConstexprC__carbon_thunk.decl: %ConstexprC__carbon_thunk.type = fn_decl @ConstexprC__carbon_thunk [concrete = constants.%ConstexprC__carbon_thunk] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -218,7 +218,7 @@ let a: array(i32, F()) = (1, 2, 3);
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.1aa = impl_witness_table (%Core.import_ref.edf), @Core.IntLiteral.as.ImplicitAs.impl.0e9 [concrete]
|
||||
// CHECK:STDOUT: %Core.import_ref.cd6: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.ac8) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.5e0)]
|
||||
// CHECK:STDOUT: %Copy.impl_witness_table.8d2 = impl_witness_table (%Core.import_ref.cd6), @Int.as.Copy.impl [concrete]
|
||||
// CHECK:STDOUT: %C.cpp_destructor.decl: %C.cpp_destructor.type = fn_decl @C.cpp_destructor [concrete = constants.%C.cpp_destructor] {
|
||||
// CHECK:STDOUT: %ConstexprC.cpp_destructor.decl: %ConstexprC.cpp_destructor.type = fn_decl @ConstexprC.cpp_destructor [concrete = constants.%ConstexprC.cpp_destructor] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -228,30 +228,30 @@ let a: array(i32, F()) = (1, 2, 3);
|
||||
// CHECK:STDOUT: fn @F() -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
|
||||
// CHECK:STDOUT: %.loc19_18.1: ref %C = temporary_storage
|
||||
// CHECK:STDOUT: %.loc19_27.1: ref %ConstexprC = temporary_storage
|
||||
// CHECK:STDOUT: %impl.elem0.loc19: %.b7a = impl_witness_access constants.%ImplicitAs.impl_witness.a2a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e39]
|
||||
// CHECK:STDOUT: %bound_method.loc19_18.1: <bound method> = bound_method %int_3, %impl.elem0.loc19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc19_27.1: <bound method> = bound_method %int_3, %impl.elem0.loc19 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn.loc19: <specific function> = specific_function %impl.elem0.loc19, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc19_18.2: <bound method> = bound_method %int_3, %specific_fn.loc19 [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_18.2(%int_3) [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %.loc19_18.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %.loc19_18.3: %i32 = converted %int_3, %.loc19_18.2 [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %addr: %ptr.0a2 = addr_of %.loc19_18.1
|
||||
// CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%.loc19_18.3, %addr)
|
||||
// CHECK:STDOUT: %.loc19_18.4: init %C to %.loc19_18.1 = mark_in_place_init %C__carbon_thunk.call
|
||||
// CHECK:STDOUT: %.loc19_18.5: init %C = converted %int_3, %.loc19_18.4
|
||||
// CHECK:STDOUT: %.loc19_18.6: ref %C = temporary %.loc19_18.1, %.loc19_18.5
|
||||
// CHECK:STDOUT: %.loc19_18.7: %C = acquire_value %.loc19_18.6
|
||||
// CHECK:STDOUT: %.loc19_13: type = splice_block %C.ref [concrete = constants.%C] {
|
||||
// CHECK:STDOUT: %bound_method.loc19_27.2: <bound method> = bound_method %int_3, %specific_fn.loc19 [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_27.2(%int_3) [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %.loc19_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %.loc19_27.3: %i32 = converted %int_3, %.loc19_27.2 [concrete = constants.%int_3.410]
|
||||
// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc19_27.1
|
||||
// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc19_27.3, %addr)
|
||||
// CHECK:STDOUT: %.loc19_27.4: init %ConstexprC to %.loc19_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call
|
||||
// CHECK:STDOUT: %.loc19_27.5: init %ConstexprC = converted %int_3, %.loc19_27.4
|
||||
// CHECK:STDOUT: %.loc19_27.6: ref %ConstexprC = temporary %.loc19_27.1, %.loc19_27.5
|
||||
// CHECK:STDOUT: %.loc19_27.7: %ConstexprC = acquire_value %.loc19_27.6
|
||||
// CHECK:STDOUT: %.loc19_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] {
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %C.ref: type = name_ref C, imports.%C.decl [concrete = constants.%C]
|
||||
// CHECK:STDOUT: %ConstexprC.ref: type = name_ref ConstexprC, imports.%ConstexprC.decl [concrete = constants.%ConstexprC]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %c: %C = wrapper_binding c, %.loc19_18.7
|
||||
// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc19_27.7
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.bbc = value_binding_pattern c [concrete = constants.%c.patt]
|
||||
// CHECK:STDOUT: %c.patt: %pattern_type.3cc = value_binding_pattern c [concrete = constants.%c.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %c.ref: %C = name_ref c, %c
|
||||
// CHECK:STDOUT: %a.ref: %C.elem = name_ref a, @C.%.1 [concrete = @C.%.1]
|
||||
// CHECK:STDOUT: %c.ref: %ConstexprC = name_ref c, %c
|
||||
// CHECK:STDOUT: %a.ref: %ConstexprC.elem = name_ref a, @ConstexprC.%.1 [concrete = @ConstexprC.%.1]
|
||||
// CHECK:STDOUT: %.loc20_11.1: ref %i32 = class_element_access %c.ref, element0
|
||||
// CHECK:STDOUT: %.loc20_11.2: %i32 = acquire_value %.loc20_11.1
|
||||
// CHECK:STDOUT: %impl.elem0.loc20: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
@@ -260,10 +260,10 @@ let a: array(i32, F()) = (1, 2, 3);
|
||||
// CHECK:STDOUT: %bound_method.loc20_11.2: <bound method> = bound_method %.loc20_11.2, %specific_fn.loc20
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc20_11.2(%.loc20_11.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %C.Op.bound: <bound method> = bound_method %.loc19_18.6, constants.%C.Op
|
||||
// CHECK:STDOUT: %Op.ref: %C.cpp_destructor.type = name_ref Op, imports.%C.cpp_destructor.decl [concrete = constants.%C.cpp_destructor]
|
||||
// CHECK:STDOUT: %C.cpp_destructor.bound: <bound method> = bound_method %.loc19_18.6, %Op.ref
|
||||
// CHECK:STDOUT: %C.cpp_destructor.call: init %empty_tuple.type = call %C.cpp_destructor.bound(%.loc19_18.6)
|
||||
// CHECK:STDOUT: %ConstexprC.Op.bound: <bound method> = bound_method %.loc19_27.6, constants.%ConstexprC.Op
|
||||
// CHECK:STDOUT: %Op.ref: %ConstexprC.cpp_destructor.type = name_ref Op, imports.%ConstexprC.cpp_destructor.decl [concrete = constants.%ConstexprC.cpp_destructor]
|
||||
// CHECK:STDOUT: %ConstexprC.cpp_destructor.bound: <bound method> = bound_method %.loc19_27.6, %Op.ref
|
||||
// CHECK:STDOUT: %ConstexprC.cpp_destructor.call: init %empty_tuple.type = call %ConstexprC.cpp_destructor.bound(%.loc19_27.6)
|
||||
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
extern "C" void foo();
|
||||
extern "C" void foo_c_fn();
|
||||
''';
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo();
|
||||
Cpp.foo_c_fn();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -29,14 +29,14 @@ fn MyF() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
extern "C" void foo();
|
||||
void foo(int x);
|
||||
extern "C" void foo_c_overloaded();
|
||||
void foo_c_overloaded(int x);
|
||||
''';
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo();
|
||||
Cpp.foo(5);
|
||||
Cpp.foo_c_overloaded();
|
||||
Cpp.foo_c_overloaded(5);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ fn MyF() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
extern "C" int foo;
|
||||
extern "C" int foo_c_var;
|
||||
''';
|
||||
|
||||
fn MyF() -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return Cpp.foo;
|
||||
return Cpp.foo_c_var;
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -73,26 +73,26 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_c_fn.cpp_overload_set.type: type = cpp_overload_set_type @foo_c_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_c_fn.cpp_overload_set.value: %foo_c_fn.cpp_overload_set.type = cpp_overload_set_value @foo_c_fn.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_c_fn.type: type = fn_type @foo_c_fn [concrete]
|
||||
// CHECK:STDOUT: %foo_c_fn: %foo_c_fn.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_c_fn = %foo_c_fn.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %foo_c_fn.cpp_overload_set.value: %foo_c_fn.cpp_overload_set.type = cpp_overload_set_value @foo_c_fn.cpp_overload_set [concrete = constants.%foo_c_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_c_fn.decl: %foo_c_fn.type = fn_decl @foo_c_fn [concrete = constants.%foo_c_fn] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %foo_c_fn.ref: %foo_c_fn.cpp_overload_set.type = name_ref foo_c_fn, imports.%foo_c_fn.cpp_overload_set.value [concrete = constants.%foo_c_fn.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_c_fn.call: init %empty_tuple.type = call imports.%foo_c_fn.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -100,15 +100,15 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type.6d9caa.1: type = fn_type @foo.1 [concrete]
|
||||
// CHECK:STDOUT: %foo.627376.1: %foo.type.6d9caa.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.cpp_overload_set.type: type = cpp_overload_set_type @foo_c_overloaded.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.cpp_overload_set.value: %foo_c_overloaded.cpp_overload_set.type = cpp_overload_set_value @foo_c_overloaded.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.type.7eb664.1: type = fn_type @foo_c_overloaded.1 [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.fee3ce.1: %foo_c_overloaded.type.7eb664.1 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %int_5.64b: Core.IntLiteral = int_value 5 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %foo.type.6d9caa.2: type = fn_type @foo.2 [concrete]
|
||||
// CHECK:STDOUT: %foo.627376.2: %foo.type.6d9caa.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.type.7eb664.2: type = fn_type @foo_c_overloaded.2 [concrete]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.fee3ce.2: %foo_c_overloaded.type.7eb664.2 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.914: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e74: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
|
||||
@@ -127,12 +127,12 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_c_overloaded = %foo_c_overloaded.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl.6431a3.1: %foo.type.6d9caa.1 = fn_decl @foo.1 [concrete = constants.%foo.627376.1] {} {}
|
||||
// CHECK:STDOUT: %foo.decl.6431a3.2: %foo.type.6d9caa.2 = fn_decl @foo.2 [concrete = constants.%foo.627376.2] {
|
||||
// CHECK:STDOUT: %foo_c_overloaded.cpp_overload_set.value: %foo_c_overloaded.cpp_overload_set.type = cpp_overload_set_value @foo_c_overloaded.cpp_overload_set [concrete = constants.%foo_c_overloaded.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.decl.9ccf4c.1: %foo_c_overloaded.type.7eb664.1 = fn_decl @foo_c_overloaded.1 [concrete = constants.%foo_c_overloaded.fee3ce.1] {} {}
|
||||
// CHECK:STDOUT: %foo_c_overloaded.decl.9ccf4c.2: %foo_c_overloaded.type.7eb664.2 = fn_decl @foo_c_overloaded.2 [concrete = constants.%foo_c_overloaded.fee3ce.2] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -144,19 +144,19 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref.loc11: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call.loc11: init %empty_tuple.type = call imports.%foo.decl.6431a3.1()
|
||||
// CHECK:STDOUT: %foo_c_overloaded.ref.loc11: %foo_c_overloaded.cpp_overload_set.type = name_ref foo_c_overloaded, imports.%foo_c_overloaded.cpp_overload_set.value [concrete = constants.%foo_c_overloaded.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.call.loc11: init %empty_tuple.type = call imports.%foo_c_overloaded.decl.9ccf4c.1()
|
||||
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref.loc12: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.ref.loc12: %foo_c_overloaded.cpp_overload_set.type = name_ref foo_c_overloaded, imports.%foo_c_overloaded.cpp_overload_set.value [concrete = constants.%foo_c_overloaded.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b]
|
||||
// CHECK:STDOUT: %impl.elem0: %.b7a = impl_witness_access constants.%ImplicitAs.impl_witness.a2a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e39]
|
||||
// CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_5, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc12_24.1: <bound method> = bound_method %int_5, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int_5, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc12_11.2(%int_5) [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %.loc12_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %.loc12_11.2: %i32 = converted %int_5, %.loc12_11.1 [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %foo.call.loc12: init %empty_tuple.type = call imports.%foo.decl.6431a3.2(%.loc12_11.2)
|
||||
// CHECK:STDOUT: %bound_method.loc12_24.2: <bound method> = bound_method %int_5, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc12_24.2(%int_5) [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %.loc12_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %.loc12_24.2: %i32 = converted %int_5, %.loc12_24.1 [concrete = constants.%int_5.eef]
|
||||
// CHECK:STDOUT: %foo_c_overloaded.call.loc12: init %empty_tuple.type = call imports.%foo_c_overloaded.decl.9ccf4c.2(%.loc12_24.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -167,8 +167,8 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.6b6: type = pattern_type %i32 [concrete]
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type.6b6 = ref_binding_pattern foo [concrete]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type.6b6 = var_pattern %foo.patt [concrete]
|
||||
// CHECK:STDOUT: %foo_c_var.patt: %pattern_type.6b6 = ref_binding_pattern foo_c_var [concrete]
|
||||
// CHECK:STDOUT: %foo_c_var.var_patt: %pattern_type.6b6 = var_pattern %foo_c_var.patt [concrete]
|
||||
// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.type.ac8: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
|
||||
// CHECK:STDOUT: %Int.as.Copy.impl.Op.5e0: %Int.as.Copy.impl.Op.type.ac8 = struct_value () [symbolic]
|
||||
@@ -183,12 +183,12 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.var
|
||||
// CHECK:STDOUT: .foo_c_var = %foo_c_var.var
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.patt: %pattern_type.6b6 = ref_binding_pattern foo [concrete = constants.%foo.patt]
|
||||
// CHECK:STDOUT: %foo.var_patt: %pattern_type.6b6 = var_pattern %foo.patt [concrete = constants.%foo.var_patt]
|
||||
// CHECK:STDOUT: %foo.var: ref %i32 = var_storage %foo.var_patt [concrete]
|
||||
// CHECK:STDOUT: %foo_c_var.patt: %pattern_type.6b6 = ref_binding_pattern foo_c_var [concrete = constants.%foo_c_var.patt]
|
||||
// CHECK:STDOUT: %foo_c_var.var_patt: %pattern_type.6b6 = var_pattern %foo_c_var.patt [concrete = constants.%foo_c_var.var_patt]
|
||||
// CHECK:STDOUT: %foo_c_var.var: ref %i32 = var_storage %foo_c_var.var_patt [concrete]
|
||||
// CHECK:STDOUT: %Core.import_ref.cd6: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.ac8) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.5e0)]
|
||||
// CHECK:STDOUT: %Copy.impl_witness_table.8d2 = impl_witness_table (%Core.import_ref.cd6), @Int.as.Copy.impl [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -197,8 +197,8 @@ fn MyF(a: Cpp.X, b: Cpp.X) -> Cpp.X {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %foo.ref: ref %i32 = name_ref foo, imports.%foo.var [concrete = imports.%foo.var]
|
||||
// CHECK:STDOUT: %.loc10: %i32 = acquire_value %foo.ref
|
||||
// CHECK:STDOUT: %foo_c_var.ref: ref %i32 = name_ref foo_c_var, imports.%foo_c_var.var [concrete = imports.%foo_c_var.var]
|
||||
// CHECK:STDOUT: %.loc10: %i32 = acquire_value %foo_c_var.ref
|
||||
// CHECK:STDOUT: %impl.elem0: %.737 = impl_witness_access constants.%Copy.impl_witness.b51, element0 [concrete = constants.%Int.as.Copy.impl.Op.4f6]
|
||||
// CHECK:STDOUT: %bound_method.loc10_13.1: <bound method> = bound_method %.loc10, %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]
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// --- global.h
|
||||
|
||||
auto foo() -> void;
|
||||
auto global_foo() -> void;
|
||||
|
||||
// --- import_global.carbon
|
||||
|
||||
@@ -26,7 +26,7 @@ import Cpp library "global.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo();
|
||||
Cpp.global_foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ fn MyF() {
|
||||
|
||||
// --- overloaded.h
|
||||
|
||||
auto foo() -> void;
|
||||
auto foo(int value) -> void;
|
||||
auto overloaded_foo() -> void;
|
||||
auto overloaded_foo(int value) -> void;
|
||||
|
||||
// --- import_overloaded.carbon
|
||||
|
||||
@@ -95,7 +95,7 @@ import Cpp library "overloaded.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo();
|
||||
Cpp.overloaded_foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ fn F() {
|
||||
|
||||
// --- variadic.h
|
||||
|
||||
auto foo(int x, ...) -> void;
|
||||
auto variadic_foo(int x, ...) -> void;
|
||||
|
||||
// --- fail_todo_import_variadic.carbon
|
||||
|
||||
@@ -116,10 +116,10 @@ import Cpp library "variadic.h";
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: fail_todo_import_variadic.carbon:[[@LINE+4]]:3: error: semantics TODO: `Unsupported: Variadic function` [SemanticsTodo]
|
||||
// CHECK:STDERR: Cpp.foo(8);
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: Cpp.variadic_foo(8);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(8);
|
||||
Cpp.variadic_foo(8);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ fn F() {
|
||||
// --- static.h
|
||||
|
||||
// TODO: Promote this warning to an error by default.
|
||||
// CHECK:STDERR: ./static.h:[[@LINE+3]]:13: warning: function 'foo' has internal linkage but is not defined [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | static auto foo() -> void;
|
||||
// CHECK:STDERR: ./static.h:[[@LINE+3]]:13: warning: function 'static_foo' has internal linkage but is not defined [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | static auto static_foo() -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
static auto foo() -> void;
|
||||
static auto static_foo() -> void;
|
||||
|
||||
// --- todo_fail_import_static.carbon
|
||||
|
||||
@@ -143,21 +143,21 @@ import Cpp library "static.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+4]]:11: note: used here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 12 | Cpp.foo();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+4]]:18: note: used here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 12 | Cpp.static_foo();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo();
|
||||
Cpp.static_foo();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
// --- template_function.h
|
||||
|
||||
template<typename T>
|
||||
auto foo(T a) -> void;
|
||||
auto template_foo(T a) -> void;
|
||||
|
||||
template<typename T>
|
||||
auto bar(T a) -> T;
|
||||
auto template_bar(T a) -> T;
|
||||
|
||||
// --- import_template_function.carbon
|
||||
|
||||
@@ -167,13 +167,13 @@ import Cpp library "template_function.h";
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.template_foo(1 as i32);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
fn G() -> i32 {
|
||||
//@dump-sem-ir-begin
|
||||
return Cpp.bar(1 as i32);
|
||||
return Cpp.template_bar(1 as i32);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -185,26 +185,26 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %global_foo.cpp_overload_set.type: type = cpp_overload_set_type @global_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %global_foo.cpp_overload_set.value: %global_foo.cpp_overload_set.type = cpp_overload_set_value @global_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %global_foo.type: type = fn_type @global_foo [concrete]
|
||||
// CHECK:STDOUT: %global_foo: %global_foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .global_foo = %global_foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %global_foo.cpp_overload_set.value: %global_foo.cpp_overload_set.type = cpp_overload_set_value @global_foo.cpp_overload_set [concrete = constants.%global_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %global_foo.decl: %global_foo.type = fn_decl @global_foo [concrete = constants.%global_foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %global_foo.ref: %global_foo.cpp_overload_set.type = name_ref global_foo, imports.%global_foo.cpp_overload_set.value [concrete = constants.%global_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %global_foo.call: init %empty_tuple.type = call imports.%global_foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -239,49 +239,49 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.type: type = cpp_overload_set_type @overloaded_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.value: %overloaded_foo.cpp_overload_set.type = cpp_overload_set_value @overloaded_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %overloaded_foo.type: type = fn_type @overloaded_foo [concrete]
|
||||
// CHECK:STDOUT: %overloaded_foo: %overloaded_foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .overloaded_foo = %overloaded_foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %overloaded_foo.cpp_overload_set.value: %overloaded_foo.cpp_overload_set.type = cpp_overload_set_value @overloaded_foo.cpp_overload_set [concrete = constants.%overloaded_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %overloaded_foo.decl: %overloaded_foo.type = fn_decl @overloaded_foo [concrete = constants.%overloaded_foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %overloaded_foo.ref: %overloaded_foo.cpp_overload_set.type = name_ref overloaded_foo, imports.%overloaded_foo.cpp_overload_set.value [concrete = constants.%overloaded_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %overloaded_foo.call: init %empty_tuple.type = call imports.%overloaded_foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: --- fail_todo_import_variadic.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.type: type = cpp_overload_set_type @variadic_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.value: %variadic_foo.cpp_overload_set.type = cpp_overload_set_value @variadic_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .variadic_foo = %variadic_foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %variadic_foo.cpp_overload_set.value: %variadic_foo.cpp_overload_set.type = cpp_overload_set_value @variadic_foo.cpp_overload_set [concrete = constants.%variadic_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %variadic_foo.ref: %variadic_foo.cpp_overload_set.type = name_ref variadic_foo, imports.%variadic_foo.cpp_overload_set.value [concrete = constants.%variadic_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
@@ -290,26 +290,26 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %static_foo.cpp_overload_set.type: type = cpp_overload_set_type @static_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %static_foo.cpp_overload_set.value: %static_foo.cpp_overload_set.type = cpp_overload_set_value @static_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %static_foo.type: type = fn_type @static_foo [concrete]
|
||||
// CHECK:STDOUT: %static_foo: %static_foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .static_foo = %static_foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %static_foo.cpp_overload_set.value: %static_foo.cpp_overload_set.type = cpp_overload_set_value @static_foo.cpp_overload_set [concrete = constants.%static_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %static_foo.decl: %static_foo.type = fn_decl @static_foo [concrete = constants.%static_foo] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %static_foo.ref: %static_foo.cpp_overload_set.type = name_ref static_foo, imports.%static_foo.cpp_overload_set.value [concrete = constants.%static_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %static_foo.call: init %empty_tuple.type = call imports.%static_foo.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -317,8 +317,8 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %template_foo.cpp_overload_set.type: type = cpp_overload_set_type @template_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %template_foo.cpp_overload_set.value: %template_foo.cpp_overload_set.type = cpp_overload_set_value @template_foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
@@ -336,30 +336,30 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.8a4, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
|
||||
// CHECK:STDOUT: %int_1.0c6: %i32 = int_value 1 [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %bar.cpp_overload_set.type: type = cpp_overload_set_type @bar.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete]
|
||||
// CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %template_foo.type: type = fn_type @template_foo [concrete]
|
||||
// CHECK:STDOUT: %template_foo: %template_foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %template_bar.cpp_overload_set.type: type = cpp_overload_set_type @template_bar.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %template_bar.cpp_overload_set.value: %template_bar.cpp_overload_set.type = cpp_overload_set_value @template_bar.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %template_bar.type: type = fn_type @template_bar [concrete]
|
||||
// CHECK:STDOUT: %template_bar: %template_bar.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .bar = %bar.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .template_foo = %template_foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .template_bar = %template_bar.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %template_foo.cpp_overload_set.value: %template_foo.cpp_overload_set.type = cpp_overload_set_value @template_foo.cpp_overload_set [concrete = constants.%template_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Core.import_ref.64b: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.c5d) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.6ee)]
|
||||
// CHECK:STDOUT: %As.impl_witness_table.d22 = impl_witness_table (%Core.import_ref.64b), @Core.IntLiteral.as.As.impl [concrete]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %template_foo.decl: %template_foo.type = fn_decl @template_foo [concrete = constants.%template_foo] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete = constants.%bar.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {
|
||||
// CHECK:STDOUT: %template_bar.cpp_overload_set.value: %template_bar.cpp_overload_set.type = cpp_overload_set_value @template_bar.cpp_overload_set [concrete = constants.%template_bar.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %template_bar.decl: %template_bar.type = fn_decl @template_bar [concrete = constants.%template_bar] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -369,34 +369,34 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %template_foo.ref: %template_foo.cpp_overload_set.type = name_ref template_foo, imports.%template_foo.cpp_overload_set.value [concrete = constants.%template_foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %impl.elem0: %.453 = impl_witness_access constants.%As.impl_witness.e7f, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.8a4]
|
||||
// CHECK:STDOUT: %bound_method.loc8_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc8_22.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc8_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc8_13.2(%int_1) [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc8_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc8_13.2: %i32 = converted %int_1, %.loc8_13.1 [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc8_13.2)
|
||||
// CHECK:STDOUT: %bound_method.loc8_22.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc8_22.2(%int_1) [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc8_22.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc8_22.2: %i32 = converted %int_1, %.loc8_22.1 [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %template_foo.call: init %empty_tuple.type = call imports.%template_foo.decl(%.loc8_22.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @G() -> out %return.param: %i32 {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %bar.ref: %bar.cpp_overload_set.type = name_ref bar, imports.%bar.cpp_overload_set.value [concrete = constants.%bar.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %template_bar.ref: %template_bar.cpp_overload_set.type = name_ref template_bar, imports.%template_bar.cpp_overload_set.value [concrete = constants.%template_bar.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
|
||||
// CHECK:STDOUT: %i32.loc14: type = type_literal constants.%i32 [concrete = constants.%i32]
|
||||
// CHECK:STDOUT: %impl.elem0: %.453 = impl_witness_access constants.%As.impl_witness.e7f, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.8a4]
|
||||
// CHECK:STDOUT: %bound_method.loc14_20.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %bound_method.loc14_29.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc14_20.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc14_20.2(%int_1) [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc14_20.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc14_20.2: %i32 = converted %int_1, %.loc14_20.1 [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %bar.call: init %i32 = call imports.%bar.decl(%.loc14_20.2)
|
||||
// CHECK:STDOUT: return %bar.call
|
||||
// CHECK:STDOUT: %bound_method.loc14_29.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc14_29.2(%int_1) [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc14_29.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %.loc14_29.2: %i32 = converted %int_1, %.loc14_29.1 [concrete = constants.%int_1.0c6]
|
||||
// CHECK:STDOUT: %template_bar.call: init %i32 = call imports.%template_bar.decl(%.loc14_29.2)
|
||||
// CHECK:STDOUT: return %template_bar.call
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// --- with_definition.h
|
||||
|
||||
inline void foo() {}
|
||||
inline void inline_with_def() {}
|
||||
|
||||
// --- import_with_definition.carbon
|
||||
|
||||
@@ -26,7 +26,7 @@ import Cpp library "with_definition.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo();
|
||||
Cpp.inline_with_def();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ fn MyF() {
|
||||
// --- without_definition.h
|
||||
|
||||
// TODO: Promote this warning to an error by default.
|
||||
// CHECK:STDERR: ./without_definition.h:[[@LINE+3]]:13: warning: inline function 'foo' is not defined [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | inline void foo();
|
||||
// CHECK:STDERR: ./without_definition.h:[[@LINE+3]]:13: warning: inline function 'inline_without_def' is not defined [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | inline void inline_without_def();
|
||||
// CHECK:STDERR: | ^
|
||||
inline void foo();
|
||||
inline void inline_without_def();
|
||||
|
||||
// --- todo_fail_import_without_definition.carbon
|
||||
|
||||
@@ -50,14 +50,14 @@ import Cpp library "without_definition.h";
|
||||
|
||||
fn MyF() {
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+4]]:11: note: used here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 12 | Cpp.foo();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+4]]:26: note: used here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 12 | Cpp.inline_without_def();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo();
|
||||
Cpp.inline_without_def();
|
||||
|
||||
// Don't error on repeated calls.
|
||||
Cpp.foo();
|
||||
Cpp.inline_without_def();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -89,26 +89,26 @@ fn MyF() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %inline_with_def.cpp_overload_set.type: type = cpp_overload_set_type @inline_with_def.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %inline_with_def.cpp_overload_set.value: %inline_with_def.cpp_overload_set.type = cpp_overload_set_value @inline_with_def.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %inline_with_def.type: type = fn_type @inline_with_def [concrete]
|
||||
// CHECK:STDOUT: %inline_with_def: %inline_with_def.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .inline_with_def = %inline_with_def.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %inline_with_def.cpp_overload_set.value: %inline_with_def.cpp_overload_set.type = cpp_overload_set_value @inline_with_def.cpp_overload_set [concrete = constants.%inline_with_def.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %inline_with_def.decl: %inline_with_def.type = fn_decl @inline_with_def [concrete = constants.%inline_with_def] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %inline_with_def.ref: %inline_with_def.cpp_overload_set.type = name_ref inline_with_def, imports.%inline_with_def.cpp_overload_set.value [concrete = constants.%inline_with_def.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %inline_with_def.call: init %empty_tuple.type = call imports.%inline_with_def.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -116,29 +116,29 @@ fn MyF() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %inline_without_def.cpp_overload_set.type: type = cpp_overload_set_type @inline_without_def.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %inline_without_def.cpp_overload_set.value: %inline_without_def.cpp_overload_set.type = cpp_overload_set_value @inline_without_def.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %inline_without_def.type: type = fn_type @inline_without_def [concrete]
|
||||
// CHECK:STDOUT: %inline_without_def: %inline_without_def.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .inline_without_def = %inline_without_def.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
||||
// CHECK:STDOUT: %inline_without_def.cpp_overload_set.value: %inline_without_def.cpp_overload_set.type = cpp_overload_set_value @inline_without_def.cpp_overload_set [concrete = constants.%inline_without_def.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %inline_without_def.decl: %inline_without_def.type = fn_decl @inline_without_def [concrete = constants.%inline_without_def] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref.loc12: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call.loc12: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %inline_without_def.ref.loc12: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %inline_without_def.call.loc12: init %empty_tuple.type = call imports.%inline_without_def.decl()
|
||||
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref.loc15: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call.loc15: init %empty_tuple.type = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %inline_without_def.ref.loc15: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %inline_without_def.call.loc15: init %empty_tuple.type = call imports.%inline_without_def.decl()
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
+115
-115
@@ -16,8 +16,8 @@
|
||||
|
||||
// --- multiple_functions_no_overloads.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto bar(short a) -> void;
|
||||
auto no_overloads_foo(short a) -> void;
|
||||
auto no_overloads_bar(short a) -> void;
|
||||
|
||||
// --- import_multiple_functions_no_overloads.carbon
|
||||
|
||||
@@ -26,13 +26,13 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "multiple_functions_no_overloads.h";
|
||||
|
||||
fn F() {
|
||||
Cpp.bar(1 as i16);
|
||||
Cpp.no_overloads_bar(1 as i16);
|
||||
}
|
||||
|
||||
// --- overloaded_functions.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto foo(int a) -> void;
|
||||
auto overloaded_foo(short a) -> void;
|
||||
auto overloaded_foo(int a) -> void;
|
||||
|
||||
// --- import_overloaded_functions.carbon
|
||||
|
||||
@@ -41,13 +41,13 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "overloaded_functions.h";
|
||||
|
||||
fn F() {
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.overloaded_foo(1 as i32);
|
||||
}
|
||||
|
||||
// --- both_overloaded_functions_called.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto foo(int a) -> void;
|
||||
auto both_called_foo(short a) -> void;
|
||||
auto both_called_foo(int a) -> void;
|
||||
|
||||
// --- import_both_overloaded_functions_called.carbon
|
||||
|
||||
@@ -56,17 +56,17 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "both_overloaded_functions_called.h";
|
||||
|
||||
fn F() {
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.foo(1 as i16);
|
||||
Cpp.both_called_foo(1 as i32);
|
||||
Cpp.both_called_foo(1 as i16);
|
||||
}
|
||||
|
||||
// --- multiple_overloaded_sets.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto foo(int a) -> void;
|
||||
auto multi_set_foo(short a) -> void;
|
||||
auto multi_set_foo(int a) -> void;
|
||||
|
||||
auto bar(long a) -> void;
|
||||
auto bar(int a) -> void;
|
||||
auto multi_set_bar(long a) -> void;
|
||||
auto multi_set_bar(int a) -> void;
|
||||
|
||||
// --- import_multiple_overloaded_sets.carbon
|
||||
|
||||
@@ -75,8 +75,8 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "multiple_overloaded_sets.h";
|
||||
|
||||
fn F() {
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.bar(1 as i32);
|
||||
Cpp.multi_set_foo(1 as i32);
|
||||
Cpp.multi_set_bar(1 as i32);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -85,17 +85,17 @@ fn F() {
|
||||
|
||||
// --- int_literal.h
|
||||
|
||||
auto foo(int a) -> int;
|
||||
auto foo(unsigned int a) -> unsigned int;
|
||||
auto int_literal_foo(int a) -> int;
|
||||
auto int_literal_foo(unsigned int a) -> unsigned int;
|
||||
|
||||
auto foo(long a) -> long;
|
||||
auto foo(unsigned long a) -> unsigned long;
|
||||
auto int_literal_foo(long a) -> long;
|
||||
auto int_literal_foo(unsigned long a) -> unsigned long;
|
||||
|
||||
auto foo(long long a) -> long long;
|
||||
auto foo(unsigned long long a) -> unsigned long long;
|
||||
auto int_literal_foo(long long a) -> long long;
|
||||
auto int_literal_foo(unsigned long long a) -> unsigned long long;
|
||||
|
||||
auto foo(__int128 a) -> __int128;
|
||||
auto foo(unsigned __int128 a) -> unsigned __int128;
|
||||
auto int_literal_foo(__int128 a) -> __int128;
|
||||
auto int_literal_foo(unsigned __int128 a) -> unsigned __int128;
|
||||
|
||||
// --- import_int_literal.carbon
|
||||
|
||||
@@ -105,30 +105,30 @@ import Cpp library "int_literal.h";
|
||||
|
||||
fn F() {
|
||||
// i32_max
|
||||
let unused a: i32 = Cpp.foo(2147483647);
|
||||
let unused a: i32 = Cpp.int_literal_foo(2147483647);
|
||||
|
||||
// i32_max + 1
|
||||
// It could fit to unsigned int, but only signed integers are considered, so assigned to long.
|
||||
// Decimal, hexadecimal and binary integer literals are treated the same when assigning a C++ type.
|
||||
let unused b: i64 = Cpp.foo(2147483648);
|
||||
let unused b_hexa: i64 = Cpp.foo(0x8000_0000);
|
||||
let unused b_binary: i64 = Cpp.foo(0b1000_0000_0000_0000_0000_0000_0000_0000);
|
||||
let unused b: i64 = Cpp.int_literal_foo(2147483648);
|
||||
let unused b_hexa: i64 = Cpp.int_literal_foo(0x8000_0000);
|
||||
let unused b_binary: i64 = Cpp.int_literal_foo(0b1000_0000_0000_0000_0000_0000_0000_0000);
|
||||
|
||||
// i64_max
|
||||
let unused c: i64 = Cpp.foo(9223372036854775807);
|
||||
let unused c: i64 = Cpp.int_literal_foo(9223372036854775807);
|
||||
|
||||
// i64_max + 1
|
||||
// Could fit to unsigned long, but only signed integers are considered, so fitted to _int128.
|
||||
let unused d: i128 = Cpp.foo(9223372036854775808);
|
||||
let unused d: i128 = Cpp.int_literal_foo(9223372036854775808);
|
||||
|
||||
// u64_max
|
||||
let unused e: i128 = Cpp.foo(18446744073709551615);
|
||||
let unused e: i128 = Cpp.int_literal_foo(18446744073709551615);
|
||||
|
||||
// u64_max + 1
|
||||
let unused f: i128 = Cpp.foo(18446744073709551616);
|
||||
let unused f: i128 = Cpp.int_literal_foo(18446744073709551616);
|
||||
|
||||
// i128_max
|
||||
let unused g: i128 = Cpp.foo(170141183460469231731687303715884105727);
|
||||
let unused g: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105727);
|
||||
}
|
||||
|
||||
// --- fail_import_large_int_literal.carbon
|
||||
@@ -140,21 +140,21 @@ import Cpp library "int_literal.h";
|
||||
fn F() {
|
||||
// TODO: get rid of the second error message here.
|
||||
// i128_max + 1
|
||||
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+8]]:32: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType]
|
||||
// CHECK:STDERR: let unused h: i128 = Cpp.foo(170141183460469231731687303715884105728);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+8]]:44: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType]
|
||||
// CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:32: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported]
|
||||
// CHECK:STDERR: let unused h: i128 = Cpp.foo(170141183460469231731687303715884105728);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:44: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported]
|
||||
// CHECK:STDERR: let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let unused h: i128 = Cpp.foo(170141183460469231731687303715884105728);
|
||||
let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
|
||||
}
|
||||
|
||||
// --- negative_int_literal.h
|
||||
|
||||
auto foo(long a) -> void;
|
||||
auto foo(int a) -> void;
|
||||
auto neg_literal_foo(long a) -> void;
|
||||
auto neg_literal_foo(int a) -> void;
|
||||
|
||||
// --- import_negative_int_literal.carbon
|
||||
|
||||
@@ -163,13 +163,13 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "negative_int_literal.h";
|
||||
|
||||
fn F() {
|
||||
// selects `auto foo(int a) -> void;`
|
||||
Cpp.foo(-1);
|
||||
// selects `auto neg_literal_foo(int a) -> void;`
|
||||
Cpp.neg_literal_foo(-1);
|
||||
}
|
||||
|
||||
// --- negative_literal_passed_to_unsigned.h
|
||||
|
||||
auto foo(unsigned int a) -> void;
|
||||
auto neg_to_unsigned_foo(unsigned int a) -> void;
|
||||
|
||||
// --- fail_import_negative_literal_passed_to_unsigned.carbon
|
||||
|
||||
@@ -178,21 +178,21 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "negative_literal_passed_to_unsigned.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+8]]:11: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: Cpp.foo(-1);
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+8]]:27: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
|
||||
// CHECK:STDERR: Cpp.neg_to_unsigned_foo(-1);
|
||||
// CHECK:STDERR: ^~
|
||||
// CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:23: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto foo(unsigned int a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:39: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto neg_to_unsigned_foo(unsigned int a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(-1);
|
||||
Cpp.neg_to_unsigned_foo(-1);
|
||||
}
|
||||
|
||||
// --- floating_point_literal.h
|
||||
|
||||
auto foo(float a) -> float;
|
||||
auto foo(double a) -> double;
|
||||
auto float_literal_foo(float a) -> float;
|
||||
auto float_literal_foo(double a) -> double;
|
||||
|
||||
// --- import_floating_point_literal.carbon
|
||||
|
||||
@@ -201,7 +201,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "floating_point_literal.h";
|
||||
|
||||
fn F() {
|
||||
let unused d: f64 = Cpp.foo(1.0);
|
||||
let unused d: f64 = Cpp.float_literal_foo(1.0);
|
||||
}
|
||||
|
||||
// --- fail_import_large_floating_point_literal.carbon
|
||||
@@ -211,15 +211,15 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "floating_point_literal.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+8]]:11: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: Cpp.foo(1.8e+308);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+8]]:25: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
|
||||
// CHECK:STDERR: Cpp.float_literal_foo(1.8e+308);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./floating_point_literal.h:3:17: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto foo(double a) -> double;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ./floating_point_literal.h:3:31: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto float_literal_foo(double a) -> double;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1.8e+308);
|
||||
Cpp.float_literal_foo(1.8e+308);
|
||||
}
|
||||
|
||||
// --- struct_init.h
|
||||
@@ -630,7 +630,7 @@ fn F() {
|
||||
|
||||
// --- upsizing.h
|
||||
|
||||
auto foo(int a) -> void;
|
||||
auto upsizing_foo(int a) -> void;
|
||||
|
||||
// --- upsizing.carbon
|
||||
|
||||
@@ -639,12 +639,12 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "upsizing.h";
|
||||
|
||||
fn F() {
|
||||
Cpp.foo(1 as i16);
|
||||
Cpp.upsizing_foo(1 as i16);
|
||||
}
|
||||
|
||||
// --- signedness_change.h
|
||||
|
||||
auto foo(unsigned int a) -> void;
|
||||
auto signedness_foo(unsigned int a) -> void;
|
||||
|
||||
// --- fail_signedness_change_rejected.carbon
|
||||
|
||||
@@ -653,23 +653,23 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "signedness_change.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure]
|
||||
// CHECK:STDERR: Cpp.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: Cpp.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure]
|
||||
// CHECK:STDERR: Cpp.signedness_foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+8]]:22: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: Cpp.signedness_foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./signedness_change.h:2:23: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto foo(unsigned int a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ./signedness_change.h:2:34: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto signedness_foo(unsigned int a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.signedness_foo(1 as i32);
|
||||
}
|
||||
|
||||
// --- downsizing_rejected.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto downsizing_foo(short a) -> void;
|
||||
|
||||
// --- fail_import_downsizing_rejected.carbon
|
||||
|
||||
@@ -678,18 +678,18 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "downsizing_rejected.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
|
||||
// CHECK:STDERR: Cpp.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: Cpp.foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
|
||||
// CHECK:STDERR: Cpp.downsizing_foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:22: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext]
|
||||
// CHECK:STDERR: Cpp.downsizing_foo(1 as i32);
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./downsizing_rejected.h:2:16: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto foo(short a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: ./downsizing_rejected.h:2:27: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: auto downsizing_foo(short a) -> void;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.downsizing_foo(1 as i32);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -698,7 +698,7 @@ fn F() {
|
||||
|
||||
// --- no_viable_function.h
|
||||
|
||||
auto foo(short a, int b) -> void;
|
||||
auto no_viable_foo(short a, int b) -> void;
|
||||
|
||||
// --- fail_import_no_viable_function.carbon
|
||||
|
||||
@@ -707,15 +707,15 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "no_viable_function.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+8]]:19: error: no matching function for call to 'foo' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | Cpp.foo(1 as i64);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+8]]:29: error: no matching function for call to 'no_viable_foo' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | Cpp.no_viable_foo(1 as i64);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable: requires 2 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 2 | auto foo(short a, int b) -> void;
|
||||
// CHECK:STDERR: | ^ ~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: 2 | auto no_viable_foo(short a, int b) -> void;
|
||||
// CHECK:STDERR: | ^ ~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1 as i64);
|
||||
Cpp.no_viable_foo(1 as i64);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -724,8 +724,8 @@ fn F() {
|
||||
|
||||
// --- ambiguous_overload.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto foo(int a) -> void;
|
||||
auto ambiguous_foo(short a) -> void;
|
||||
auto ambiguous_foo(int a) -> void;
|
||||
|
||||
// --- fail_import_ambiguous_overload.carbon
|
||||
|
||||
@@ -734,19 +734,19 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "ambiguous_overload.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+12]]:19: error: call to 'foo' is ambiguous [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Cpp.foo(1 as i64);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+12]]:29: error: call to 'ambiguous_foo' is ambiguous [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Cpp.ambiguous_foo(1 as i64);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./ambiguous_overload.h:2:6: note: candidate function [CppInteropParseNote]
|
||||
// CHECK:STDERR: 2 | auto foo(short a) -> void;
|
||||
// CHECK:STDERR: 2 | auto ambiguous_foo(short a) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./ambiguous_overload.h:3:6: note: candidate function [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | auto foo(int a) -> void;
|
||||
// CHECK:STDERR: 3 | auto ambiguous_foo(int a) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1 as i64);
|
||||
Cpp.ambiguous_foo(1 as i64);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -755,8 +755,8 @@ fn F() {
|
||||
|
||||
// --- deleted_function.h
|
||||
|
||||
auto foo(short a) -> void;
|
||||
auto foo(int a) -> void = delete;
|
||||
auto deleted_foo(short a) -> void;
|
||||
auto deleted_foo(int a) -> void = delete;
|
||||
|
||||
// --- fail_import_deleted_function.carbon
|
||||
|
||||
@@ -765,27 +765,27 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "deleted_function.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+12]]:19: error: call to deleted function 'foo' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Cpp.foo(1 as i32);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+12]]:27: error: call to deleted function 'deleted_foo' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Cpp.deleted_foo(1 as i32);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./deleted_function.h:3:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | auto foo(int a) -> void = delete;
|
||||
// CHECK:STDERR: 3 | auto deleted_foo(int a) -> void = delete;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./deleted_function.h:2:6: note: candidate function [CppInteropParseNote]
|
||||
// CHECK:STDERR: 2 | auto foo(short a) -> void;
|
||||
// CHECK:STDERR: 2 | auto deleted_foo(short a) -> void;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo(1 as i32);
|
||||
Cpp.deleted_foo(1 as i32);
|
||||
}
|
||||
|
||||
// --- fail_missing_impl.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
void foo();
|
||||
void foo(int);
|
||||
void missing_impl_foo();
|
||||
void missing_impl_foo(int);
|
||||
''';
|
||||
|
||||
interface I {}
|
||||
@@ -793,12 +793,12 @@ interface I {}
|
||||
fn EchoValue[ValueT: I](unused generic value: ValueT) {}
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `<type of Cpp.foo>` into type implementing `I` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: EchoValue(Cpp.foo);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `<type of Cpp.missing_impl_foo>` into type implementing `I` [ConversionFailureTypeToFacet]
|
||||
// CHECK:STDERR: EchoValue(Cpp.missing_impl_foo);
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
||||
// CHECK:STDERR: fn EchoValue[ValueT: I](unused generic value: ValueT) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
EchoValue(Cpp.foo);
|
||||
EchoValue(Cpp.missing_impl_foo);
|
||||
}
|
||||
|
||||
+836
-836
File diff suppressed because it is too large
Load Diff
@@ -462,23 +462,23 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
class X {}
|
||||
class XByRef {}
|
||||
|
||||
inline Cpp '''c++
|
||||
template<typename T> void TakeAnything_ExpectConstLRef(T&&) {
|
||||
static_assert(__is_same(T, const Carbon::X&));
|
||||
template<typename T> void TakeAnything_ExpectConstLRef_ByRef(T&&) {
|
||||
static_assert(__is_same(T, const Carbon::XByRef&));
|
||||
}
|
||||
''';
|
||||
|
||||
fn PassConstRef(ref x: const X) {
|
||||
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+7]]:36: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam]
|
||||
// CHECK:STDERR: Cpp.TakeAnything_ExpectConstLRef(ref x);
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-9]]:59: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: template<typename T> void TakeAnything_ExpectConstLRef(T&&) {
|
||||
// CHECK:STDERR: ^
|
||||
fn PassConstRef(ref x: const XByRef) {
|
||||
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+7]]:42: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam]
|
||||
// CHECK:STDERR: Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x);
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-9]]:65: note: initializing function parameter [InCallToFunctionParam]
|
||||
// CHECK:STDERR: template<typename T> void TakeAnything_ExpectConstLRef_ByRef(T&&) {
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.TakeAnything_ExpectConstLRef(ref x);
|
||||
Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+394
-394
File diff suppressed because it is too large
Load Diff
@@ -29,9 +29,9 @@ let min_explicit_literal: i32 = Cpp.min(i32, 1, 2);
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<typename> struct X;
|
||||
template<typename> struct Y;
|
||||
template<template<typename> typename... TT, typename... T> void f(T ...a) {}
|
||||
template<typename> struct TemplateTemplateX;
|
||||
template<typename> struct TemplateTemplateY;
|
||||
template<template<typename> typename... TT, typename... T> void template_template_fn(T ...a) {}
|
||||
''';
|
||||
|
||||
fn Call() {
|
||||
@@ -40,15 +40,15 @@ fn Call() {
|
||||
|
||||
// `a` and `b` are not classified as template arguments, so are passed as the
|
||||
// function parameter pack `a...`.
|
||||
Cpp.f(a, b);
|
||||
Cpp.template_template_fn(a, b);
|
||||
|
||||
// `Cpp.X` and `Cpp.Y` are classified as template template arguments, so they
|
||||
// `Cpp.TemplateTemplateX` and `Cpp.TemplateTemplateY` are classified as template template arguments, so they
|
||||
// are passed as the template parameter pack `TT...`.
|
||||
Cpp.f(Cpp.X, Cpp.Y);
|
||||
Cpp.template_template_fn(Cpp.TemplateTemplateX, Cpp.TemplateTemplateY);
|
||||
|
||||
// Pass some template arguments followed by some function arguments.
|
||||
Cpp.f(Cpp.X, Cpp.Y, a, b);
|
||||
Cpp.f(Cpp.X, a, b, a);
|
||||
Cpp.template_template_fn(Cpp.TemplateTemplateX, Cpp.TemplateTemplateY, a, b);
|
||||
Cpp.template_template_fn(Cpp.TemplateTemplateX, a, b, a);
|
||||
}
|
||||
|
||||
// --- nontype_template_arg.carbon
|
||||
@@ -56,25 +56,25 @@ fn Call() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<int... I, typename... T> void f(T ...a) {}
|
||||
template<int I = 0, int J = 0, typename = void, typename... T> void g(T ...a) {}
|
||||
template<int... I, typename... T> void nontype_f(T ...a) {}
|
||||
template<int I = 0, int J = 0, typename = void, typename... T> void nontype_g(T ...a) {}
|
||||
''';
|
||||
|
||||
fn Call() {
|
||||
let a: i32 = 0;
|
||||
let b: i32 = 0;
|
||||
|
||||
Cpp.f(a, b);
|
||||
Cpp.nontype_f(a, b);
|
||||
// TODO: There should be a way to indicate that the arguments are template
|
||||
// arguments, not function arguments, when calling `f`.
|
||||
Cpp.f(1, 2);
|
||||
// arguments, not function arguments, when calling `nontype_f`.
|
||||
Cpp.nontype_f(1, 2);
|
||||
|
||||
// Two function arguments.
|
||||
Cpp.g(1, 2);
|
||||
Cpp.nontype_g(1, 2);
|
||||
// Three template arguments.
|
||||
Cpp.g(1, 2, i32);
|
||||
Cpp.nontype_g(1, 2, i32);
|
||||
// Three template arguments and two function arguments.
|
||||
Cpp.g(1, 2, i32, 3, 4);
|
||||
Cpp.nontype_g(1, 2, i32, 3, 4);
|
||||
}
|
||||
|
||||
// --- fail_function_arg_not_template_arg.carbon
|
||||
@@ -82,19 +82,19 @@ fn Call() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<int N> void f();
|
||||
template<int N> void fn_arg_not_template_arg_f();
|
||||
''';
|
||||
|
||||
fn Call() {
|
||||
// We treat this as a function argument, even though that makes the call fail.
|
||||
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+7]]:10: error: no matching function for call to 'f' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Cpp.f(1);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+7]]:34: error: no matching function for call to 'fn_arg_not_template_arg_f' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Cpp.fn_arg_not_template_arg_f(1);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-8]]:22: note: candidate function template not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | template<int N> void f();
|
||||
// CHECK:STDERR: 5 | template<int N> void fn_arg_not_template_arg_f();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
Cpp.f(1);
|
||||
Cpp.fn_arg_not_template_arg_f(1);
|
||||
}
|
||||
|
||||
// --- function_arg_not_template_arg_overloaded.carbon
|
||||
@@ -102,12 +102,12 @@ fn Call() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<int N> void f();
|
||||
void f(int n);
|
||||
template<int N> void overloaded_f();
|
||||
void overloaded_f(int n);
|
||||
''';
|
||||
|
||||
fn Call() {
|
||||
Cpp.f(1);
|
||||
Cpp.overloaded_f(1);
|
||||
}
|
||||
|
||||
// --- overloaded_with_different_template_params.carbon
|
||||
@@ -115,18 +115,18 @@ fn Call() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<typename T> struct X;
|
||||
struct Y;
|
||||
template<typename T> struct OverloadedTemplateX;
|
||||
struct OverloadedNonTemplateY;
|
||||
|
||||
template<int N, typename T> void f();
|
||||
template<typename T> void f();
|
||||
template<template<typename> typename T> void f();
|
||||
template<int N, typename T> void different_template_params_f();
|
||||
template<typename T> void different_template_params_f();
|
||||
template<template<typename> typename T> void different_template_params_f();
|
||||
''';
|
||||
|
||||
fn Call() {
|
||||
Cpp.f(1, i32);
|
||||
Cpp.f(Cpp.X);
|
||||
Cpp.f(Cpp.Y);
|
||||
Cpp.different_template_params_f(1, i32);
|
||||
Cpp.different_template_params_f(Cpp.OverloadedTemplateX);
|
||||
Cpp.different_template_params_f(Cpp.OverloadedNonTemplateY);
|
||||
}
|
||||
|
||||
// --- only_call_templates_when_given_template_args.carbon
|
||||
@@ -137,13 +137,13 @@ import Cpp inline '''
|
||||
struct NonTemplate {};
|
||||
struct Template {};
|
||||
|
||||
NonTemplate f(unsigned char, unsigned char);
|
||||
template<typename = void> Template f(unsigned char, int = 0);
|
||||
NonTemplate only_call_templates_f(unsigned char, unsigned char);
|
||||
template<typename = void> Template only_call_templates_f(unsigned char, int = 0);
|
||||
''';
|
||||
|
||||
// Prefers the non-template because it has a better match for the second parameter.
|
||||
let x: Cpp.NonTemplate = Cpp.f(1 as u8, 2 as u8);
|
||||
let x: Cpp.NonTemplate = Cpp.only_call_templates_f(1 as u8, 2 as u8);
|
||||
|
||||
// Calls the template; the non-template is not considered due to the template
|
||||
// argument `i32`.
|
||||
let y: Cpp.Template = Cpp.f(i32, 1 as u8);
|
||||
let y: Cpp.Template = Cpp.only_call_templates_f(i32, 1 as u8);
|
||||
|
||||
+365
-365
File diff suppressed because it is too large
Load Diff
+144
-144
@@ -15,12 +15,12 @@
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto foo(void* _Nonnull x) -> void;
|
||||
auto foo_non_nullable_param(void* _Nonnull x) -> void;
|
||||
''';
|
||||
|
||||
fn F(input: Cpp.void*) {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo(input);
|
||||
Cpp.foo_non_nullable_param(input);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ fn F(input: Cpp.void*) {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto foo() -> void* _Nonnull;
|
||||
auto foo_non_nullable_return() -> void* _Nonnull;
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
let unused output: Cpp.void* = Cpp.foo();
|
||||
let unused output: Cpp.void* = Cpp.foo_non_nullable_return();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto foo(void* x) -> void;
|
||||
auto foo_nullable_param(void* x) -> void;
|
||||
''';
|
||||
|
||||
fn F(input: Cpp.void*) {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo(input);
|
||||
Cpp.foo_nullable_param(input);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ fn F(input: Cpp.void*) {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto foo(void* x) -> void;
|
||||
auto foo_null_param(void* x) -> void;
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
Cpp.foo(Core.Optional(Cpp.void*).None());
|
||||
Cpp.foo_null_param(Core.Optional(Cpp.void*).None());
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto foo() -> void*;
|
||||
auto foo_nullable_return() -> void*;
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
let unused output: Core.Optional(Cpp.void*) = Cpp.foo();
|
||||
let unused output: Core.Optional(Cpp.void*) = Cpp.foo_nullable_return();
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -85,14 +85,14 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto Return() -> void* _Nonnull* _Nonnull;
|
||||
auto Invoke(void* _Nonnull* _Nonnull) -> void;
|
||||
auto Return_pointer() -> void* _Nonnull* _Nonnull;
|
||||
auto Invoke_pointer(void* _Nonnull* _Nonnull) -> void;
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
var non_nullable_pointer: Cpp.void** = Cpp.Return();
|
||||
Cpp.Invoke(non_nullable_pointer);
|
||||
var non_nullable_pointer: Cpp.void** = Cpp.Return_pointer();
|
||||
Cpp.Invoke_pointer(non_nullable_pointer);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -101,14 +101,14 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
auto Return() -> const void* _Nonnull;
|
||||
auto Invoke(const void* _Nonnull) -> void;
|
||||
auto Return_const() -> const void* _Nonnull;
|
||||
auto Invoke_const(const void* _Nonnull) -> void;
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
//@dump-sem-ir-begin
|
||||
var const_void_pointer: const Cpp.void* = Cpp.Return();
|
||||
Cpp.Invoke(const_void_pointer);
|
||||
var const_void_pointer: const Cpp.void* = Cpp.Return_const();
|
||||
Cpp.Invoke_const(const_void_pointer);
|
||||
//@dump-sem-ir-end
|
||||
}
|
||||
|
||||
@@ -118,20 +118,20 @@ fn F() {
|
||||
// CHECK:STDOUT: %Cpp.void: type = class_type @VoidBase [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Cpp.void [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.cpp_overload_set.type: type = cpp_overload_set_type @foo_non_nullable_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.cpp_overload_set.value: %foo_non_nullable_param.cpp_overload_set.type = cpp_overload_set_value @foo_non_nullable_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.type: type = fn_type @foo_non_nullable_param [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param: %foo_non_nullable_param.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_non_nullable_param = %foo_non_nullable_param.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.cpp_overload_set.value: %foo_non_nullable_param.cpp_overload_set.type = cpp_overload_set_value @foo_non_nullable_param.cpp_overload_set [concrete = constants.%foo_non_nullable_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.decl: %foo_non_nullable_param.type = fn_decl @foo_non_nullable_param [concrete = constants.%foo_non_nullable_param] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -141,9 +141,9 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F(%input.param: %ptr) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.ref: %foo_non_nullable_param.cpp_overload_set.type = name_ref foo_non_nullable_param, imports.%foo_non_nullable_param.cpp_overload_set.value [concrete = constants.%foo_non_nullable_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %input.ref: %ptr = name_ref input, %input
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%input.ref)
|
||||
// CHECK:STDOUT: %foo_non_nullable_param.call: init %empty_tuple.type = call imports.%foo_non_nullable_param.decl(%input.ref)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -154,20 +154,20 @@ fn F() {
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %Cpp.void [concrete]
|
||||
// CHECK:STDOUT: %pattern_type: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %output.patt: %pattern_type = value_binding_pattern output [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.cpp_overload_set.type: type = cpp_overload_set_type @foo_non_nullable_return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.cpp_overload_set.value: %foo_non_nullable_return.cpp_overload_set.type = cpp_overload_set_value @foo_non_nullable_return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.type: type = fn_type @foo_non_nullable_return [concrete]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return: %foo_non_nullable_return.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_non_nullable_return = %foo_non_nullable_return.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.cpp_overload_set.value: %foo_non_nullable_return.cpp_overload_set.type = cpp_overload_set_value @foo_non_nullable_return.cpp_overload_set [concrete = constants.%foo_non_nullable_return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.decl: %foo_non_nullable_return.type = fn_decl @foo_non_nullable_return [concrete = constants.%foo_non_nullable_return] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -177,16 +177,16 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_34: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %ptr = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %.loc10_42.1: %ptr = value_of_initializer %foo.call
|
||||
// CHECK:STDOUT: %.loc10_42.2: %ptr = converted %foo.call, %.loc10_42.1
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.ref: %foo_non_nullable_return.cpp_overload_set.type = name_ref foo_non_nullable_return, imports.%foo_non_nullable_return.cpp_overload_set.value [concrete = constants.%foo_non_nullable_return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_non_nullable_return.call: init %ptr = call imports.%foo_non_nullable_return.decl()
|
||||
// CHECK:STDOUT: %.loc10_62.1: %ptr = value_of_initializer %foo_non_nullable_return.call
|
||||
// CHECK:STDOUT: %.loc10_62.2: %ptr = converted %foo_non_nullable_return.call, %.loc10_62.1
|
||||
// CHECK:STDOUT: %.loc10_30: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %void.ref: type = name_ref void, constants.%Cpp.void [concrete = constants.%Cpp.void]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %void.ref [concrete = constants.%ptr]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %output: %ptr = wrapper_binding output, %.loc10_42.2
|
||||
// CHECK:STDOUT: %output: %ptr = wrapper_binding output, %.loc10_62.2
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %output.patt: %pattern_type = value_binding_pattern output [concrete = constants.%output.patt]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -199,8 +199,8 @@ fn F() {
|
||||
// CHECK:STDOUT: %Cpp.void: type = class_type @VoidBase [concrete]
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %ptr.00a: type = ptr_type %Cpp.void [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_param.cpp_overload_set.type: type = cpp_overload_set_type @foo_nullable_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_param.cpp_overload_set.value: %foo_nullable_param.cpp_overload_set.type = cpp_overload_set_value @foo_nullable_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %OptionalStorage.type: type = facet_type <@OptionalStorage> [concrete]
|
||||
// CHECK:STDOUT: %T.220: %OptionalStorage.type = symbolic_binding T, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
|
||||
@@ -220,8 +220,8 @@ fn F() {
|
||||
// CHECK:STDOUT: %.a7d: type = maybe_unformed_type %ptr.00a [concrete]
|
||||
// CHECK:STDOUT: %OptionalStorage.facet.427: %OptionalStorage.type = facet_value %ptr.00a, (%OptionalStorage.impl_witness.d51) [concrete]
|
||||
// CHECK:STDOUT: %Optional.14b: type = class_type @Optional, @Optional(%OptionalStorage.facet.427) [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_param.type: type = fn_type @foo_nullable_param [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_param: %foo_nullable_param.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.8e0: type = facet_type <@ImplicitAs, @ImplicitAs(%Optional.14b)> [concrete]
|
||||
// CHECK:STDOUT: %OptionalAs.type.3b8: type = facet_type <@OptionalAs, @OptionalAs(%T.220)> [symbolic]
|
||||
// CHECK:STDOUT: %U.042: %OptionalAs.type.3b8 = symbolic_binding U, 1 [symbolic]
|
||||
@@ -239,17 +239,17 @@ fn F() {
|
||||
// CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.002: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%Optional.14b, %ImplicitAs.facet.3be) [concrete]
|
||||
// CHECK:STDOUT: %.fde: type = fn_type_with_self_type %ImplicitAs.WithSelf.Convert.type.002, %ImplicitAs.facet.3be [concrete]
|
||||
// CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %U.as_type.as.ImplicitAs.impl.Convert.f63, @U.as_type.as.ImplicitAs.impl.Convert.2(%OptionalStorage.facet.427, %OptionalAs.facet) [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_11.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_26.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.1a2547.4: %Destroy.Op.type.1d8f74.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_nullable_param = %foo_nullable_param.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_nullable_param.cpp_overload_set.value: %foo_nullable_param.cpp_overload_set.type = cpp_overload_set_value @foo_nullable_param.cpp_overload_set [concrete = constants.%foo_nullable_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Core.import_ref.509: type = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%MaybeUnformed (constants.%MaybeUnformed.ddb)]
|
||||
// CHECK:STDOUT: %Core.import_ref.105 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.fa7: @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some.type (%ptr.as.OptionalStorage.impl.Some.type.71e) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @ptr.as.OptionalStorage.impl.%ptr.as.OptionalStorage.impl.Some (constants.%ptr.as.OptionalStorage.impl.Some.caa)]
|
||||
@@ -257,13 +257,13 @@ fn F() {
|
||||
// CHECK:STDOUT: %Core.import_ref.306 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.3e3 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %OptionalStorage.impl_witness_table.110 = impl_witness_table (%Core.import_ref.509, %Core.import_ref.105, %Core.import_ref.fa7, %Core.import_ref.a90, %Core.import_ref.306, %Core.import_ref.3e3), @ptr.as.OptionalStorage.impl [concrete]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %foo_nullable_param.decl: %foo_nullable_param.type = fn_decl @foo_nullable_param [concrete = constants.%foo_nullable_param] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %.loc10_16.1: type = splice_block %Optional [concrete = constants.%Optional.14b] {
|
||||
// CHECK:STDOUT: %.loc10_31.1: type = splice_block %Optional [concrete = constants.%Optional.14b] {
|
||||
// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.00a, (constants.%OptionalStorage.impl_witness.d51) [concrete = constants.%OptionalStorage.facet.427]
|
||||
// CHECK:STDOUT: %.loc10_16.2: %OptionalStorage.type = converted constants.%ptr.00a, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.427]
|
||||
// CHECK:STDOUT: %.loc10_31.2: %OptionalStorage.type = converted constants.%ptr.00a, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet.427]
|
||||
// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet.427) [concrete = constants.%Optional.14b]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -277,34 +277,34 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F(%input.param: %ptr.00a) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_nullable_param.ref: %foo_nullable_param.cpp_overload_set.type = name_ref foo_nullable_param, imports.%foo_nullable_param.cpp_overload_set.value [concrete = constants.%foo_nullable_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input
|
||||
// CHECK:STDOUT: %impl.elem0: %.fde = impl_witness_access constants.%ImplicitAs.impl_witness.50c, element0 [concrete = constants.%U.as_type.as.ImplicitAs.impl.Convert.f63]
|
||||
// CHECK:STDOUT: %bound_method.loc10_11.1: <bound method> = bound_method %input.ref, %impl.elem0
|
||||
// CHECK:STDOUT: %bound_method.loc10_26.1: <bound method> = bound_method %input.ref, %impl.elem0
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @U.as_type.as.ImplicitAs.impl.Convert.2(constants.%OptionalStorage.facet.427, constants.%OptionalAs.facet) [concrete = constants.%U.as_type.as.ImplicitAs.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc10_11.2: <bound method> = bound_method %input.ref, %specific_fn
|
||||
// CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.14b = call %bound_method.loc10_11.2(%input.ref)
|
||||
// CHECK:STDOUT: %.loc10_11.1: init %Optional.14b = converted %input.ref, %U.as_type.as.ImplicitAs.impl.Convert.call
|
||||
// CHECK:STDOUT: %.loc10_11.2: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_11.3: ref %Optional.14b = temporary %.loc10_11.2, %.loc10_11.1
|
||||
// CHECK:STDOUT: %.loc10_11.4: %Optional.14b = acquire_value %.loc10_11.3
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc10_11.4)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_11.3, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_11.3)
|
||||
// CHECK:STDOUT: %bound_method.loc10_26.2: <bound method> = bound_method %input.ref, %specific_fn
|
||||
// CHECK:STDOUT: %U.as_type.as.ImplicitAs.impl.Convert.call: init %Optional.14b = call %bound_method.loc10_26.2(%input.ref)
|
||||
// CHECK:STDOUT: %.loc10_26.1: init %Optional.14b = converted %input.ref, %U.as_type.as.ImplicitAs.impl.Convert.call
|
||||
// CHECK:STDOUT: %.loc10_26.2: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_26.3: ref %Optional.14b = temporary %.loc10_26.2, %.loc10_26.1
|
||||
// CHECK:STDOUT: %.loc10_26.4: %Optional.14b = acquire_value %.loc10_26.3
|
||||
// CHECK:STDOUT: %foo_nullable_param.call: init %empty_tuple.type = call imports.%foo_nullable_param.decl(%.loc10_26.4)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_26.3, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_26.3)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_11.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_26.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_11.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_26.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_11.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_26.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
@@ -313,8 +313,8 @@ fn F() {
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_null_param.cpp_overload_set.type: type = cpp_overload_set_type @foo_null_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_null_param.cpp_overload_set.value: %foo_null_param.cpp_overload_set.type = cpp_overload_set_value @foo_null_param.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Optional.type: type = generic_class_type @Optional [concrete]
|
||||
// CHECK:STDOUT: %Optional.generic: %Optional.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %OptionalStorage.type: type = facet_type <@OptionalStorage> [concrete]
|
||||
@@ -343,9 +343,9 @@ fn F() {
|
||||
// CHECK:STDOUT: %Optional.None.type.18e: type = fn_type @Optional.None, @Optional(%OptionalStorage.facet) [concrete]
|
||||
// CHECK:STDOUT: %Optional.None.aa9: %Optional.None.type.18e = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Optional.None.specific_fn: <specific function> = specific_function %Optional.None.aa9, @Optional.None(%OptionalStorage.facet) [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_41.3 [concrete]
|
||||
// CHECK:STDOUT: %foo_null_param.type: type = fn_type @foo_null_param [concrete]
|
||||
// CHECK:STDOUT: %foo_null_param: %foo_null_param.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_52.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.1a2547.4: %Destroy.Op.type.1d8f74.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -358,11 +358,11 @@ fn F() {
|
||||
// CHECK:STDOUT: import Core//prelude/...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_null_param = %foo_null_param.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_null_param.cpp_overload_set.value: %foo_null_param.cpp_overload_set.type = cpp_overload_set_value @foo_null_param.cpp_overload_set [concrete = constants.%foo_null_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Core.Optional: %Optional.type = import_ref Core//prelude/types/optional, Optional, loaded [concrete = constants.%Optional.generic]
|
||||
// CHECK:STDOUT: %Core.import_ref.e9f: @Optional.%Optional.None.type (%Optional.None.type.bdc) = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, loaded [symbolic = @Optional.%Optional.None (constants.%Optional.None.01e)]
|
||||
// CHECK:STDOUT: %Core.CppCompat: <namespace> = import_ref Core//prelude, CppCompat, loaded
|
||||
@@ -379,13 +379,13 @@ fn F() {
|
||||
// CHECK:STDOUT: %Core.import_ref.306 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.3e3 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %OptionalStorage.impl_witness_table.110 = impl_witness_table (%Core.import_ref.509, %Core.import_ref.307, %Core.import_ref.c9a, %Core.import_ref.a90, %Core.import_ref.306, %Core.import_ref.3e3), @ptr.as.OptionalStorage.impl [concrete]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %foo_null_param.decl: %foo_null_param.type = fn_decl @foo_null_param [concrete = constants.%foo_null_param] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %.loc10_42.1: type = splice_block %Optional [concrete = constants.%Optional.14b] {
|
||||
// CHECK:STDOUT: %.loc10_53.1: type = splice_block %Optional [concrete = constants.%Optional.14b] {
|
||||
// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.00a, (constants.%OptionalStorage.impl_witness.d51) [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %.loc10_42.2: %OptionalStorage.type = converted constants.%ptr.00a, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %.loc10_53.2: %OptionalStorage.type = converted constants.%ptr.00a, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.14b]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -396,39 +396,39 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_null_param.ref: %foo_null_param.cpp_overload_set.type = name_ref foo_null_param, imports.%foo_null_param.cpp_overload_set.value [concrete = constants.%foo_null_param.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %Optional.ref: %Optional.type = name_ref Optional, imports.%Core.Optional [concrete = constants.%Optional.generic]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_25: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %void.ref: type = name_ref void, constants.%Cpp.void [concrete = constants.%Cpp.void]
|
||||
// CHECK:STDOUT: %ptr: type = ptr_type %void.ref [concrete = constants.%ptr.00a]
|
||||
// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value %ptr, (constants.%OptionalStorage.impl_witness.d51) [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %.loc10_34: %OptionalStorage.type = converted %ptr, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %.loc10_45: %OptionalStorage.type = converted %ptr, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.14b]
|
||||
// CHECK:STDOUT: %.loc10_35: %Optional.None.type.18e = specific_constant imports.%Core.import_ref.e9f, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.None.aa9]
|
||||
// CHECK:STDOUT: %None.ref: %Optional.None.type.18e = name_ref None, %.loc10_35 [concrete = constants.%Optional.None.aa9]
|
||||
// CHECK:STDOUT: %.loc10_46: %Optional.None.type.18e = specific_constant imports.%Core.import_ref.e9f, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.None.aa9]
|
||||
// CHECK:STDOUT: %None.ref: %Optional.None.type.18e = name_ref None, %.loc10_46 [concrete = constants.%Optional.None.aa9]
|
||||
// CHECK:STDOUT: %Optional.None.specific_fn: <specific function> = specific_function %None.ref, @Optional.None(constants.%OptionalStorage.facet) [concrete = constants.%Optional.None.specific_fn]
|
||||
// CHECK:STDOUT: %Optional.None.call: init %Optional.14b = call %Optional.None.specific_fn()
|
||||
// CHECK:STDOUT: %.loc10_41.1: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_41.2: ref %Optional.14b = temporary %.loc10_41.1, %Optional.None.call
|
||||
// CHECK:STDOUT: %.loc10_41.3: %Optional.14b = acquire_value %.loc10_41.2
|
||||
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc10_41.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_41.2, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_41.2)
|
||||
// CHECK:STDOUT: %.loc10_52.1: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_52.2: ref %Optional.14b = temporary %.loc10_52.1, %Optional.None.call
|
||||
// CHECK:STDOUT: %.loc10_52.3: %Optional.14b = acquire_value %.loc10_52.2
|
||||
// CHECK:STDOUT: %foo_null_param.call: init %empty_tuple.type = call imports.%foo_null_param.decl(%.loc10_52.3)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_52.2, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_52.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_41.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_52.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_41.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_52.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_41.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_52.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
@@ -459,11 +459,11 @@ fn F() {
|
||||
// CHECK:STDOUT: %Optional.14b: type = class_type @Optional, @Optional(%OptionalStorage.facet) [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.65e: type = pattern_type %Optional.14b [concrete]
|
||||
// CHECK:STDOUT: %output.patt: %pattern_type.65e = value_binding_pattern output [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
||||
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_57.3 [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_return.cpp_overload_set.type: type = cpp_overload_set_type @foo_nullable_return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_return.cpp_overload_set.value: %foo_nullable_return.cpp_overload_set.type = cpp_overload_set_value @foo_nullable_return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_return.type: type = fn_type @foo_nullable_return [concrete]
|
||||
// CHECK:STDOUT: %foo_nullable_return: %foo_nullable_return.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type.1d8f74.4: type = fn_type @Destroy.Op.loc10_73.3 [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.1a2547.4: %Destroy.Op.type.1d8f74.4 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -477,7 +477,7 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .foo_nullable_return = %foo_nullable_return.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Core.Optional: %Optional.type = import_ref Core//prelude/types/optional, Optional, loaded [concrete = constants.%Optional.generic]
|
||||
@@ -495,8 +495,8 @@ fn F() {
|
||||
// CHECK:STDOUT: %Core.import_ref.306 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %Core.import_ref.3e3 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded
|
||||
// CHECK:STDOUT: %OptionalStorage.impl_witness_table.110 = impl_witness_table (%Core.import_ref.509, %Core.import_ref.105, %Core.import_ref.c9a, %Core.import_ref.a90, %Core.import_ref.306, %Core.import_ref.3e3), @ptr.as.OptionalStorage.impl [concrete]
|
||||
// CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
|
||||
// CHECK:STDOUT: %foo_nullable_return.cpp_overload_set.value: %foo_nullable_return.cpp_overload_set.type = cpp_overload_set_value @foo_nullable_return.cpp_overload_set [concrete = constants.%foo_nullable_return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_nullable_return.decl: %foo_nullable_return.type = fn_decl @foo_nullable_return [concrete = constants.%foo_nullable_return] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: %OptionalStorage.facet: %OptionalStorage.type = facet_value constants.%ptr.00a, (constants.%OptionalStorage.impl_witness.d51) [concrete = constants.%OptionalStorage.facet]
|
||||
@@ -510,11 +510,11 @@ fn F() {
|
||||
// CHECK:STDOUT: fn @F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc10_49: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo.call: init %Optional.14b = call imports.%foo.decl()
|
||||
// CHECK:STDOUT: %.loc10_57.1: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_57.2: ref %Optional.14b = temporary %.loc10_57.1, %foo.call
|
||||
// CHECK:STDOUT: %.loc10_57.3: %Optional.14b = acquire_value %.loc10_57.2
|
||||
// CHECK:STDOUT: %foo_nullable_return.ref: %foo_nullable_return.cpp_overload_set.type = name_ref foo_nullable_return, imports.%foo_nullable_return.cpp_overload_set.value [concrete = constants.%foo_nullable_return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %foo_nullable_return.call: init %Optional.14b = call imports.%foo_nullable_return.decl()
|
||||
// CHECK:STDOUT: %.loc10_73.1: ref %Optional.14b = temporary_storage
|
||||
// CHECK:STDOUT: %.loc10_73.2: ref %Optional.14b = temporary %.loc10_73.1, %foo_nullable_return.call
|
||||
// CHECK:STDOUT: %.loc10_73.3: %Optional.14b = acquire_value %.loc10_73.2
|
||||
// CHECK:STDOUT: %.loc10_45.1: type = splice_block %Optional [concrete = constants.%Optional.14b] {
|
||||
// CHECK:STDOUT: %Core.ref: <namespace> = name_ref Core, imports.%Core [concrete = imports.%Core]
|
||||
// CHECK:STDOUT: %Optional.ref: %Optional.type = name_ref Optional, imports.%Core.Optional [concrete = constants.%Optional.generic]
|
||||
@@ -525,26 +525,26 @@ fn F() {
|
||||
// CHECK:STDOUT: %.loc10_45.2: %OptionalStorage.type = converted %ptr, %OptionalStorage.facet [concrete = constants.%OptionalStorage.facet]
|
||||
// CHECK:STDOUT: %Optional: type = class_type @Optional, @Optional(constants.%OptionalStorage.facet) [concrete = constants.%Optional.14b]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %output: %Optional.14b = wrapper_binding output, %.loc10_57.3
|
||||
// CHECK:STDOUT: %output: %Optional.14b = wrapper_binding output, %.loc10_73.3
|
||||
// CHECK:STDOUT: name_binding_decl {
|
||||
// CHECK:STDOUT: %output.patt: %pattern_type.65e = value_binding_pattern output [concrete = constants.%output.patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_57.2, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_57.2)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %.loc10_73.2, constants.%Destroy.Op.1a2547.4
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%.loc10_73.2)
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_57.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_73.1(%self.param: ref %.a7d) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_57.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_73.2(%self.param: ref %MaybeUnformed.399) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_57.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: fn @Destroy.Op.loc10_73.3(%self.param: ref %Optional.14b) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
@@ -559,14 +559,14 @@ fn F() {
|
||||
// CHECK:STDOUT: %pattern_type.c1e: type = pattern_type %ptr.6f9 [concrete]
|
||||
// CHECK:STDOUT: %non_nullable_pointer.patt: %pattern_type.c1e = ref_binding_pattern non_nullable_pointer [concrete]
|
||||
// CHECK:STDOUT: %non_nullable_pointer.var_patt: %pattern_type.c1e = var_pattern %non_nullable_pointer.patt [concrete]
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.type: type = cpp_overload_set_type @Return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.value: %Return.cpp_overload_set.type = cpp_overload_set_value @Return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return.type: type = fn_type @Return [concrete]
|
||||
// CHECK:STDOUT: %Return: %Return.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.type: type = cpp_overload_set_type @Invoke.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.value: %Invoke.cpp_overload_set.type = cpp_overload_set_value @Invoke.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke.type: type = fn_type @Invoke [concrete]
|
||||
// CHECK:STDOUT: %Invoke: %Invoke.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Return_pointer.cpp_overload_set.type: type = cpp_overload_set_type @Return_pointer.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return_pointer.cpp_overload_set.value: %Return_pointer.cpp_overload_set.type = cpp_overload_set_value @Return_pointer.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return_pointer.type: type = fn_type @Return_pointer [concrete]
|
||||
// CHECK:STDOUT: %Return_pointer: %Return_pointer.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Invoke_pointer.cpp_overload_set.type: type = cpp_overload_set_type @Invoke_pointer.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke_pointer.cpp_overload_set.value: %Invoke_pointer.cpp_overload_set.type = cpp_overload_set_value @Invoke_pointer.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke_pointer.type: type = fn_type @Invoke_pointer [concrete]
|
||||
// CHECK:STDOUT: %Invoke_pointer: %Invoke_pointer.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -574,18 +574,18 @@ fn F() {
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .Return = %Return.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Invoke = %Invoke.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Return_pointer = %Return_pointer.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Invoke_pointer = %Invoke_pointer.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.value: %Return.cpp_overload_set.type = cpp_overload_set_value @Return.cpp_overload_set [concrete = constants.%Return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return.decl: %Return.type = fn_decl @Return [concrete = constants.%Return] {
|
||||
// CHECK:STDOUT: %Return_pointer.cpp_overload_set.value: %Return_pointer.cpp_overload_set.type = cpp_overload_set_value @Return_pointer.cpp_overload_set [concrete = constants.%Return_pointer.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return_pointer.decl: %Return_pointer.type = fn_decl @Return_pointer [concrete = constants.%Return_pointer] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.value: %Invoke.cpp_overload_set.type = cpp_overload_set_value @Invoke.cpp_overload_set [concrete = constants.%Invoke.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke.decl: %Invoke.type = fn_decl @Invoke [concrete = constants.%Invoke] {
|
||||
// CHECK:STDOUT: %Invoke_pointer.cpp_overload_set.value: %Invoke_pointer.cpp_overload_set.type = cpp_overload_set_value @Invoke_pointer.cpp_overload_set [concrete = constants.%Invoke_pointer.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke_pointer.decl: %Invoke_pointer.type = fn_decl @Invoke_pointer [concrete = constants.%Invoke_pointer] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -596,9 +596,9 @@ fn F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %non_nullable_pointer.var: ref %ptr.6f9 = var_storage %non_nullable_pointer.var_patt
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11_42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Return.ref: %Return.cpp_overload_set.type = name_ref Return, imports.%Return.cpp_overload_set.value [concrete = constants.%Return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return.call: init %ptr.6f9 = call imports.%Return.decl()
|
||||
// CHECK:STDOUT: assign %non_nullable_pointer.var, %Return.call
|
||||
// CHECK:STDOUT: %Return_pointer.ref: %Return_pointer.cpp_overload_set.type = name_ref Return_pointer, imports.%Return_pointer.cpp_overload_set.value [concrete = constants.%Return_pointer.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return_pointer.call: init %ptr.6f9 = call imports.%Return_pointer.decl()
|
||||
// CHECK:STDOUT: assign %non_nullable_pointer.var, %Return_pointer.call
|
||||
// CHECK:STDOUT: %.loc11: type = splice_block %ptr.loc11_38 [concrete = constants.%ptr.6f9] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11_29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %void.ref: type = name_ref void, constants.%Cpp.void [concrete = constants.%Cpp.void]
|
||||
@@ -611,10 +611,10 @@ fn F() {
|
||||
// CHECK:STDOUT: %non_nullable_pointer.var_patt: %pattern_type.c1e = var_pattern %non_nullable_pointer.patt [concrete = constants.%non_nullable_pointer.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Invoke.ref: %Invoke.cpp_overload_set.type = name_ref Invoke, imports.%Invoke.cpp_overload_set.value [concrete = constants.%Invoke.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke_pointer.ref: %Invoke_pointer.cpp_overload_set.type = name_ref Invoke_pointer, imports.%Invoke_pointer.cpp_overload_set.value [concrete = constants.%Invoke_pointer.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %non_nullable_pointer.ref: ref %ptr.6f9 = name_ref non_nullable_pointer, %non_nullable_pointer
|
||||
// CHECK:STDOUT: %.loc12: %ptr.6f9 = acquire_value %non_nullable_pointer.ref
|
||||
// CHECK:STDOUT: %Invoke.call: init %empty_tuple.type = call imports.%Invoke.decl(%.loc12)
|
||||
// CHECK:STDOUT: %Invoke_pointer.call: init %empty_tuple.type = call imports.%Invoke_pointer.decl(%.loc12)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %non_nullable_pointer.var, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%non_nullable_pointer.var)
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -632,14 +632,14 @@ fn F() {
|
||||
// CHECK:STDOUT: %pattern_type.c83: type = pattern_type %ptr [concrete]
|
||||
// CHECK:STDOUT: %const_void_pointer.patt: %pattern_type.c83 = ref_binding_pattern const_void_pointer [concrete]
|
||||
// CHECK:STDOUT: %const_void_pointer.var_patt: %pattern_type.c83 = var_pattern %const_void_pointer.patt [concrete]
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.type: type = cpp_overload_set_type @Return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.value: %Return.cpp_overload_set.type = cpp_overload_set_value @Return.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return.type: type = fn_type @Return [concrete]
|
||||
// CHECK:STDOUT: %Return: %Return.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.type: type = cpp_overload_set_type @Invoke.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.value: %Invoke.cpp_overload_set.type = cpp_overload_set_value @Invoke.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke.type: type = fn_type @Invoke [concrete]
|
||||
// CHECK:STDOUT: %Invoke: %Invoke.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Return_const.cpp_overload_set.type: type = cpp_overload_set_type @Return_const.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return_const.cpp_overload_set.value: %Return_const.cpp_overload_set.type = cpp_overload_set_value @Return_const.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Return_const.type: type = fn_type @Return_const [concrete]
|
||||
// CHECK:STDOUT: %Return_const: %Return_const.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Invoke_const.cpp_overload_set.type: type = cpp_overload_set_type @Invoke_const.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke_const.cpp_overload_set.value: %Invoke_const.cpp_overload_set.type = cpp_overload_set_value @Invoke_const.cpp_overload_set [concrete]
|
||||
// CHECK:STDOUT: %Invoke_const.type: type = fn_type @Invoke_const [concrete]
|
||||
// CHECK:STDOUT: %Invoke_const: %Invoke_const.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op.type: type = fn_type @Destroy.Op [concrete]
|
||||
// CHECK:STDOUT: %Destroy.Op: %Destroy.Op.type = struct_value () [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -647,18 +647,18 @@ fn F() {
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .void = constants.%Cpp.void
|
||||
// CHECK:STDOUT: .Return = %Return.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Invoke = %Invoke.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Return_const = %Return_const.cpp_overload_set.value
|
||||
// CHECK:STDOUT: .Invoke_const = %Invoke_const.cpp_overload_set.value
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Return.cpp_overload_set.value: %Return.cpp_overload_set.type = cpp_overload_set_value @Return.cpp_overload_set [concrete = constants.%Return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return.decl: %Return.type = fn_decl @Return [concrete = constants.%Return] {
|
||||
// CHECK:STDOUT: %Return_const.cpp_overload_set.value: %Return_const.cpp_overload_set.type = cpp_overload_set_value @Return_const.cpp_overload_set [concrete = constants.%Return_const.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return_const.decl: %Return_const.type = fn_decl @Return_const [concrete = constants.%Return_const] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Invoke.cpp_overload_set.value: %Invoke.cpp_overload_set.type = cpp_overload_set_value @Invoke.cpp_overload_set [concrete = constants.%Invoke.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke.decl: %Invoke.type = fn_decl @Invoke [concrete = constants.%Invoke] {
|
||||
// CHECK:STDOUT: %Invoke_const.cpp_overload_set.value: %Invoke_const.cpp_overload_set.type = cpp_overload_set_value @Invoke_const.cpp_overload_set [concrete = constants.%Invoke_const.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke_const.decl: %Invoke_const.type = fn_decl @Invoke_const [concrete = constants.%Invoke_const] {
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: } {
|
||||
// CHECK:STDOUT: <elided>
|
||||
@@ -669,9 +669,9 @@ fn F() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %const_void_pointer.var: ref %ptr = var_storage %const_void_pointer.var_patt
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11_45: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Return.ref: %Return.cpp_overload_set.type = name_ref Return, imports.%Return.cpp_overload_set.value [concrete = constants.%Return.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return.call: init %ptr = call imports.%Return.decl()
|
||||
// CHECK:STDOUT: assign %const_void_pointer.var, %Return.call
|
||||
// CHECK:STDOUT: %Return_const.ref: %Return_const.cpp_overload_set.type = name_ref Return_const, imports.%Return_const.cpp_overload_set.value [concrete = constants.%Return_const.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Return_const.call: init %ptr = call imports.%Return_const.decl()
|
||||
// CHECK:STDOUT: assign %const_void_pointer.var, %Return_const.call
|
||||
// CHECK:STDOUT: %.loc11: type = splice_block %ptr [concrete = constants.%ptr] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc11_33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %void.ref: type = name_ref void, constants.%Cpp.void [concrete = constants.%Cpp.void]
|
||||
@@ -684,10 +684,10 @@ fn F() {
|
||||
// CHECK:STDOUT: %const_void_pointer.var_patt: %pattern_type.c83 = var_pattern %const_void_pointer.patt [concrete = constants.%const_void_pointer.var_patt]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %Invoke.ref: %Invoke.cpp_overload_set.type = name_ref Invoke, imports.%Invoke.cpp_overload_set.value [concrete = constants.%Invoke.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %Invoke_const.ref: %Invoke_const.cpp_overload_set.type = name_ref Invoke_const, imports.%Invoke_const.cpp_overload_set.value [concrete = constants.%Invoke_const.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %const_void_pointer.ref: ref %ptr = name_ref const_void_pointer, %const_void_pointer
|
||||
// CHECK:STDOUT: %.loc12: %ptr = acquire_value %const_void_pointer.ref
|
||||
// CHECK:STDOUT: %Invoke.call: init %empty_tuple.type = call imports.%Invoke.decl(%.loc12)
|
||||
// CHECK:STDOUT: %Invoke_const.call: init %empty_tuple.type = call imports.%Invoke_const.decl(%.loc12)
|
||||
// CHECK:STDOUT: %Destroy.Op.bound: <bound method> = bound_method %const_void_pointer.var, constants.%Destroy.Op
|
||||
// CHECK:STDOUT: %Destroy.Op.call: init %empty_tuple.type = call %Destroy.Op.bound(%const_void_pointer.var)
|
||||
// CHECK:STDOUT: <elided>
|
||||
|
||||
+32
-32
@@ -650,8 +650,8 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
enum A { a = 1, b = 2 };
|
||||
#define M_A_NO_SCOPE a
|
||||
enum A_NoScope { a_no_scope = 1, b_no_scope = 2 };
|
||||
#define M_A_NO_SCOPE a_no_scope
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
@@ -691,8 +691,8 @@ let p: const i32* = &Cpp.N;
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
constexpr int a = 1;
|
||||
#define M_CONSTEXPR_NO_SCOPE a
|
||||
constexpr int a_no_scope = 1;
|
||||
#define M_CONSTEXPR_NO_SCOPE a_no_scope
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
@@ -892,8 +892,8 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
int v = 1;
|
||||
#define m &v
|
||||
int v_ptr = 1;
|
||||
#define m &v_ptr
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
@@ -905,14 +905,14 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
struct B {
|
||||
struct SubB {
|
||||
int c;
|
||||
};
|
||||
struct A {
|
||||
B b;
|
||||
struct SubA {
|
||||
SubB b;
|
||||
};
|
||||
A a;
|
||||
#define m a.b.c
|
||||
SubA a_obj;
|
||||
#define m a_obj.b.c
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
@@ -956,11 +956,11 @@ fn F() {
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
struct A {
|
||||
struct BaseA {
|
||||
int n;
|
||||
};
|
||||
struct B : A {} b;
|
||||
#define m b.n
|
||||
struct DerivedB : BaseA {} b_obj;
|
||||
#define m b_obj.n
|
||||
''';
|
||||
|
||||
fn F() {
|
||||
@@ -2182,15 +2182,15 @@ let _: C(1) = {} as C(Cpp.COUNT);
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
|
||||
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
|
||||
// CHECK:STDOUT: %A: type = class_type @A [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.3fa: type = pattern_type %A [concrete]
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.3fa = ref_binding_pattern a [concrete]
|
||||
// CHECK:STDOUT: %a.var_patt: %pattern_type.3fa = var_pattern %a.patt [concrete]
|
||||
// CHECK:STDOUT: %B: type = class_type @B [concrete]
|
||||
// CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %B [concrete]
|
||||
// CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %i32 [concrete]
|
||||
// CHECK:STDOUT: %.401: ref %B = class_element_access imports.%a.var, element0 [concrete]
|
||||
// CHECK:STDOUT: %.8f5: ref %i32 = class_element_access %.401, element0 [concrete]
|
||||
// CHECK:STDOUT: %SubA: type = class_type @SubA [concrete]
|
||||
// CHECK:STDOUT: %pattern_type.0f5: type = pattern_type %SubA [concrete]
|
||||
// CHECK:STDOUT: %a_obj.patt: %pattern_type.0f5 = ref_binding_pattern a_obj [concrete]
|
||||
// CHECK:STDOUT: %a_obj.var_patt: %pattern_type.0f5 = var_pattern %a_obj.patt [concrete]
|
||||
// CHECK:STDOUT: %SubB: type = class_type @SubB [concrete]
|
||||
// CHECK:STDOUT: %SubA.elem: type = unbound_element_type %SubA, %SubB [concrete]
|
||||
// CHECK:STDOUT: %SubB.elem: type = unbound_element_type %SubB, %i32 [concrete]
|
||||
// CHECK:STDOUT: %.d13: ref %SubB = class_element_access imports.%a_obj.var, element0 [concrete]
|
||||
// CHECK:STDOUT: %.010: ref %i32 = class_element_access %.d13, element0 [concrete]
|
||||
// CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
|
||||
// CHECK:STDOUT: %ImplicitAs.type.914: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
||||
@@ -2210,12 +2210,12 @@ let _: C(1) = {} as C(Cpp.COUNT);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: imports {
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .m = constants.%.8f5
|
||||
// CHECK:STDOUT: .m = constants.%.010
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %a.patt: %pattern_type.3fa = ref_binding_pattern a [concrete = constants.%a.patt]
|
||||
// CHECK:STDOUT: %a.var_patt: %pattern_type.3fa = var_pattern %a.patt [concrete = constants.%a.var_patt]
|
||||
// CHECK:STDOUT: %a.var: ref %A = var_storage %a.var_patt [concrete]
|
||||
// CHECK:STDOUT: %a_obj.patt: %pattern_type.0f5 = ref_binding_pattern a_obj [concrete = constants.%a_obj.patt]
|
||||
// CHECK:STDOUT: %a_obj.var_patt: %pattern_type.0f5 = var_pattern %a_obj.patt [concrete = constants.%a_obj.var_patt]
|
||||
// CHECK:STDOUT: %a_obj.var: ref %SubA = var_storage %a_obj.var_patt [concrete]
|
||||
// CHECK:STDOUT: %Core.import_ref.edf: @Core.IntLiteral.as.ImplicitAs.impl.0e9.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e74) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.0e9.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.845)]
|
||||
// CHECK:STDOUT: %ImplicitAs.impl_witness_table.1aa = impl_witness_table (%Core.import_ref.edf), @Core.IntLiteral.as.ImplicitAs.impl.0e9 [concrete]
|
||||
// CHECK:STDOUT: }
|
||||
@@ -2224,11 +2224,11 @@ let _: C(1) = {} as C(Cpp.COUNT);
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: <elided>
|
||||
// CHECK:STDOUT: %b.ref: %A.elem = name_ref b, @A.%.1 [concrete = @A.%.1]
|
||||
// CHECK:STDOUT: %.loc17_6.1: ref %B = class_element_access imports.%a.var, element0 [concrete = constants.%.401]
|
||||
// CHECK:STDOUT: %c.ref: %B.elem = name_ref c, @B.%.1 [concrete = @B.%.1]
|
||||
// CHECK:STDOUT: %.loc17_6.2: ref %i32 = class_element_access %.loc17_6.1, element0 [concrete = constants.%.8f5]
|
||||
// CHECK:STDOUT: %m.ref: ref %i32 = name_ref m, constants.%.8f5 [concrete = constants.%.8f5]
|
||||
// CHECK:STDOUT: %b.ref: %SubA.elem = name_ref b, @SubA.%.1 [concrete = @SubA.%.1]
|
||||
// CHECK:STDOUT: %.loc17_6.1: ref %SubB = class_element_access imports.%a_obj.var, element0 [concrete = constants.%.d13]
|
||||
// CHECK:STDOUT: %c.ref: %SubB.elem = name_ref c, @SubB.%.1 [concrete = @SubB.%.1]
|
||||
// CHECK:STDOUT: %.loc17_6.2: ref %i32 = class_element_access %.loc17_6.1, element0 [concrete = constants.%.010]
|
||||
// CHECK:STDOUT: %m.ref: ref %i32 = name_ref m, constants.%.010 [concrete = constants.%.010]
|
||||
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
|
||||
// CHECK:STDOUT: %impl.elem0: %.b7a = impl_witness_access constants.%ImplicitAs.impl_witness.a2a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e39]
|
||||
// CHECK:STDOUT: %bound_method.loc17_9.1: <bound method> = bound_method %int_2, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
|
||||
|
||||
@@ -84,17 +84,17 @@ import Cpp;
|
||||
alias r#Cpp = Cpp;
|
||||
|
||||
inline Cpp '''
|
||||
void F();
|
||||
void FRaw();
|
||||
|
||||
void G() {
|
||||
void GRaw() {
|
||||
// CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+8]]:16: error: semantics TODO: `interop with translation unit decl` [SemanticsTodo]
|
||||
// CHECK:STDERR: Carbon::Cpp::F();
|
||||
// CHECK:STDERR: Carbon::Cpp::FRaw();
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+4]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::Cpp::F();
|
||||
// CHECK:STDERR: 19 | Carbon::Cpp::FRaw();
|
||||
// CHECK:STDERR: | ~~~~~~~~^
|
||||
// CHECK:STDERR:
|
||||
Carbon::Cpp::F();
|
||||
Carbon::Cpp::FRaw();
|
||||
}
|
||||
''';
|
||||
|
||||
+896
-896
File diff suppressed because it is too large
Load Diff
+1431
-1431
File diff suppressed because it is too large
Load Diff
@@ -83,33 +83,34 @@ var s: Cpp.Simple({} as C) = Cpp.MakeSimple123();
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<bool B> struct Struct {};
|
||||
Struct<true> MakeStruct() { return Struct<true>(); }
|
||||
template<bool B> struct BoolStruct {};
|
||||
BoolStruct<true> MakeBoolStruct() { return BoolStruct<true>(); }
|
||||
''';
|
||||
|
||||
var s: Cpp.Struct(true) = Cpp.MakeStruct();
|
||||
var s: Cpp.BoolStruct(true) = Cpp.MakeBoolStruct();
|
||||
|
||||
// --- float.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<float N> struct Struct {};
|
||||
Struct<123.5f> MakeStruct() { return Struct<123.5f>(); }
|
||||
template<float N> struct FloatStruct {};
|
||||
FloatStruct<123.5f> MakeFloatStruct() { return FloatStruct<123.5f>(); }
|
||||
''';
|
||||
let v: Cpp.Struct(123.5) = Cpp.MakeStruct();
|
||||
|
||||
let v: Cpp.FloatStruct(123.5) = Cpp.MakeFloatStruct();
|
||||
|
||||
// --- pointer.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp inline '''
|
||||
template<const int* _Nonnull P> struct Struct {};
|
||||
template<const int* _Nonnull P> struct PtrStruct {};
|
||||
static int i = 123;
|
||||
Struct<&i> MakeStruct() { return Struct<&i>(); }
|
||||
PtrStruct<&i> MakePtrStruct() { return PtrStruct<&i>(); }
|
||||
''';
|
||||
|
||||
let xyz: Cpp.Struct(&Cpp.i) = Cpp.MakeStruct();
|
||||
let xyz: Cpp.PtrStruct(&Cpp.i) = Cpp.MakePtrStruct();
|
||||
|
||||
// --- valid.carbon
|
||||
|
||||
|
||||
@@ -29,17 +29,17 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:5: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: var x: () = ();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: var unsupported_x: () = ();
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
var x: () = ();
|
||||
var unsupported_x: () = ();
|
||||
|
||||
inline Cpp '''
|
||||
void F() {
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:11: error: no member named 'x' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+4]]:11: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::unsupported_x;
|
||||
// CHECK:STDERR: | ^~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
Carbon::x;
|
||||
Carbon::unsupported_x;
|
||||
}
|
||||
''';
|
||||
|
||||
+10
-10
@@ -42,7 +42,7 @@ fn MyF() {
|
||||
// --- unsupported_type.h
|
||||
|
||||
using UnusupportedType = _BitInt(23);
|
||||
UnusupportedType global;
|
||||
UnusupportedType unsupported_global;
|
||||
|
||||
// --- fail_import_unsupported_type.carbon
|
||||
|
||||
@@ -56,17 +56,17 @@ import Cpp library "unsupported_type.h";
|
||||
|
||||
fn MyF() {
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+11]]:21: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+7]]:44: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:44: note: in `Cpp` name lookup for `global` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+4]]:44: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup]
|
||||
// CHECK:STDERR: let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
let unused local: Cpp.UnusupportedType = Cpp.global;
|
||||
let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- import_global_scope.carbon
|
||||
@@ -198,7 +198,7 @@ fn MyF() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
||||
// CHECK:STDOUT: .UnusupportedType = <error>
|
||||
// CHECK:STDOUT: .global = <error>
|
||||
// CHECK:STDOUT: .unsupported_global = <error>
|
||||
// CHECK:STDOUT: import Cpp//...
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: }
|
||||
@@ -219,7 +219,7 @@ fn MyF() {
|
||||
// CHECK:STDOUT: fn @MyF() {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %Cpp.ref.loc22_44: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %global.ref: <error> = name_ref global, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %unsupported_global.ref: <error> = name_ref unsupported_global, <error> [concrete = <error>]
|
||||
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
|
||||
// CHECK:STDOUT: %Cpp.ref.loc22_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %UnusupportedType.ref: <error> = name_ref UnusupportedType, <error> [concrete = <error>]
|
||||
|
||||
Reference in New Issue
Block a user