Switch tests to use the rendered form of diagnostics (#8070)

Historically, we disabled the rendered form in tests outside of
`toolchain/diagnostics`. The idea was to keep tests shorter and avoid
very long chains of autoupdate before stabilizing due to all the line
numbers and other artifacts in the rendered form.

This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to
`first` in tests. This keeps the rendered form so that we can easily
code review that form and the visual cues it does or doesn't provide.
But it removes all but the first location's line numbers to provide
significantly more stability in tests.

By default, tests get the full unicode line-drawing form of diagnostics
so we can ensure all of the artifacts there make sense with the specific
case being diagnosed, but we do retain some focused ASCII-rendering
tests to ensure that fallback remains usable.

There are some issues here that will be fixed in subsequent PRs.
Notably, we try to keep the frame together in the check lines, and so
force some parts to use the first location. This largely works, but
fails in some edge cases, causing the entire frame to be located
incorrectly. There is a TODO about this that we need to fix, and it only
occurs 6 times across the test suite, so it didn't seem worth
front-loading a fix for here.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-05 07:19:59 +00:00
1 parent 0b7059a360
commit d0badecd2a
888 files changed
+39731 -12799

No files matched your search

@@ -24,10 +24,22 @@ class B {
inline Cpp '''
void F() {
auto b = Carbon::B::Make();
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+17]]:5
// CHECK:STDERR: │ private var a: A = {};
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.a;
}
@@ -47,8 +59,16 @@ class B {
inline Cpp '''
void G() {
auto b = Carbon::B::Make();
// CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE+3]]:5: error: 'F' is a private member of 'Carbon::Main::B' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE-7]]:18: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_method.carbon:[[@LINE+11]]:5
// CHECK:STDERR: │ private fn F() {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.F();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'F' is a private member of 'Carbon::Main::B'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.F();
}
@@ -71,10 +91,22 @@ fn MakeB() -> B(A) {
inline Cpp '''
void F() {
auto b = Carbon::MakeB();
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B<Carbon::Main::A>' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE-11]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+17]]:5
// CHECK:STDERR: │ private var a: A = {};
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B<Carbon::Main::A>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.a;
}
@@ -88,7 +120,12 @@ class A {}
class B(T: type) {
// TODO: exporting of methods in generics is not yet supported.
// CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:3-18: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ private fn F() {}
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
private fn F() {}
}
@@ -101,7 +138,12 @@ inline Cpp '''
void F() {
auto b = Carbon::MakeB();
// TODO: this error should be that `F` is a private member of `B`.
// CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:5: error: no member named 'F' in 'Carbon::Main::B<Carbon::Main::A>' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ b.F();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'F' in 'Carbon::Main::B<Carbon::Main::A>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.F();
}
+113 -17
View File
@@ -62,8 +62,16 @@ import Cpp;
class FinalClass {}
inline Cpp '''
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError]
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-4]]:18: note: 'FinalClass' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+11]]:12
// CHECK:STDERR: │ class FinalClass {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'FinalClass' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ struct A : Carbon::FinalClass {};
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: base 'FinalClass' is marked 'final'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
struct A : Carbon::FinalClass {};
''';
@@ -80,16 +88,40 @@ struct VirtualDestructor {
};
''';
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:1-34: error: cannot convert type `AbstractWithVdtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithVdtor {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithVdtor` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithVdtor {
extend base: Cpp.VirtualDestructor;
}
inline Cpp '''
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:27: error: variable type 'Carbon::AbstractWithVdtor' (aka 'Carbon::Main::AbstractWithVdtor') is an abstract class [CppInteropParseError]
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-6]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+16]]:27
// CHECK:STDERR: │ abstract class AbstractWithVdtor {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method
// CHECK:STDERR: · │ '~AbstractWithVdtor' in
// CHECK:STDERR: · │ 'AbstractWithVdtor'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::AbstractWithVdtor x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable type 'Carbon::AbstractWithVdtor'
// CHECK:STDERR: · ┃ (aka 'Carbon::Main::AbstractWithVdtor') is
// CHECK:STDERR: · ┃ an abstract class
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AbstractWithVdtor x;
''';
@@ -101,10 +133,28 @@ 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+5]]:1-39: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+23]]:1
// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `exporting abstract class with no abstract methods and non-virtual destructor to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+3]]:1-39: error: cannot convert type `AbstractNonvirtualDtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {}
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractNonvirtualDtor` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractNonvirtualDtor {}
@@ -120,8 +170,19 @@ 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+3]]:1-41: error: cannot convert type `AbstractWithMethodNoVptr` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithMethodNoVptr {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethodNoVptr` into type
// CHECK:STDERR: · ┃ implementing `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethodNoVptr {
abstract fn F(self);
@@ -140,16 +201,40 @@ 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+3]]:1-35: error: cannot convert type `AbstractWithMethod` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithMethod {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethod` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethod {
abstract fn F(self);
}
inline Cpp '''
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:28: error: variable type 'Carbon::AbstractWithMethod' (aka 'Carbon::Main::AbstractWithMethod') is an abstract class [CppInteropParseError]
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-5]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+16]]:28
// CHECK:STDERR: │ abstract fn F(self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method 'F' in
// CHECK:STDERR: · │ 'AbstractWithMethod'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::AbstractWithMethod x_abstract;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable type
// CHECK:STDERR: · ┃ 'Carbon::AbstractWithMethod' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::AbstractWithMethod') is an
// CHECK:STDERR: · ┃ abstract class
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AbstractWithMethod x_abstract;
''';
@@ -162,8 +247,19 @@ 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+3]]:1-35: error: cannot convert type `AbstractToOverride` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractToOverride {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractToOverride` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractToOverride {
abstract fn F(ref self);
@@ -59,13 +59,30 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+2]]:1-26: error: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class IncompleteConcreteA;
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: class was forward declared here
// CHECK:STDERR: · ┃ [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class IncompleteConcreteA;
inline Cpp '''
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+3]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' (aka 'Carbon::Main::IncompleteConcreteA') [CppInteropParseError]
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-4]]:26: note: forward declaration of 'Carbon::Main::IncompleteConcreteA' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+15]]:29
// CHECK:STDERR: │ class IncompleteConcreteA;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of
// CHECK:STDERR: · │ 'Carbon::Main::IncompleteConcreteA'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::IncompleteConcreteA incomplete_concrete_a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable has incomplete type
// CHECK:STDERR: · ┃ 'Carbon::IncompleteConcreteA' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::IncompleteConcreteA')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::IncompleteConcreteA incomplete_concrete_a;
''';
@@ -75,7 +92,12 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class B(N: i32) {
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `binding maps to a non-type template parameter`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class B(N: i32) {
var a: array(i8, N);
@@ -86,9 +108,18 @@ class B(N: i32) {
alias T = B(-1);
inline Cpp '''
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+13]]:1
// CHECK:STDERR: -> │ Carbon::T t;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:9
// CHECK:STDERR: -> │ Carbon::T t;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'T' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::T t;
''';
@@ -75,10 +75,20 @@ class EmptyClass {}
inline Cpp '''
void AccessNonexistentField() {
Carbon::EmptyClass a;
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::EmptyClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x = 12;
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::EmptyClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y = 34;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.y = 34;
}
@@ -89,10 +99,20 @@ library "[[@TEST_NAME]]";
import Cpp;
class UnsupportedFieldType {
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7
// CHECK:STDERR: -> │ var x: ();
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: ();
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7
// CHECK:STDERR: -> │ var y: ();
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var y: ();
}
@@ -100,10 +120,20 @@ class UnsupportedFieldType {
inline Cpp '''
void AccessUnsupportedField() {
Carbon::UnsupportedFieldType a;
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x;
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.y;
}
@@ -120,7 +150,12 @@ class AdaptedClass {
inline Cpp '''
void AccessAdaptedField() {
Carbon::AdaptedClass a;
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::AdaptedClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_adapter.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::AdaptedClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x = 12;
}
@@ -132,7 +167,11 @@ import Cpp;
// This should not cause a crash.
class InvalidBaseClass {
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:16-21: error: name `Whoops` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:16
// CHECK:STDERR: -> │ extend base: Whoops;
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: name `Whoops` not found [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Whoops;
}
@@ -156,8 +195,17 @@ class ClassWithPrivateField {
inline Cpp '''
int AccessPrivateField() {
auto c = Carbon::ClassWithPrivateField::Make();
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+3]]:12: error: 'x' is a private member of 'Carbon::Main::ClassWithPrivateField' [CppInteropParseError]
// CHECK:STDERR: fail_private_field.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_private_field.carbon:[[@LINE+12]]:12
// CHECK:STDERR: │ private var x: i32;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return c.x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of
// CHECK:STDERR: · ┃ 'Carbon::Main::ClassWithPrivateField'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c.x;
}
@@ -45,7 +45,12 @@ void FSpecific() {
library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:1-33: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class UnsupportedClass(T: type) {
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map specific type arg to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class UnsupportedClass(T: type) {
var t: T;
@@ -54,9 +59,19 @@ alias AliasEmptyTuple = UnsupportedClass(());
inline Cpp '''
void FUnsupported() {
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+14]]:11
// CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'AliasEmptyTuple' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AliasEmptyTuple a;
a.t = 123;
@@ -68,7 +83,12 @@ library "[[@TEST_NAME]]";
import Cpp;
class ClassWithMethod(T: type) {
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:3-25: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ fn M(unused ref self) {}
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn M(unused ref self) {}
}
@@ -76,7 +96,12 @@ class ClassWithMethod(T: type) {
inline Cpp '''
void FMethodCall() {
Carbon::ClassWithMethod<int> c;
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:5: error: no member named 'M' in 'Carbon::Main::ClassWithMethod<int>' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ c.M();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'M' in 'Carbon::Main::ClassWithMethod<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.M();
}
@@ -92,8 +92,17 @@ class RefMethodRValueClass {
inline Cpp '''
void RefMethodRValue() {
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError]
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ref_method_rvalue.carbon:[[@LINE+12]]:3
// CHECK:STDERR: │ fn M(ref self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::RefMethodRValueClass().M();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' is an rvalue, but function
// CHECK:STDERR: · ┃ has non-const lvalue ref-qualifier
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::RefMethodRValueClass().M();
}
@@ -109,8 +118,19 @@ class RefMethodConstLValueClass {
inline Cpp '''
void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) {
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass' (aka 'const Carbon::Main::RefMethodConstLValueClass'), but function is not marked const [CppInteropParseError]
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ref_method_const_lvalue.carbon:[[@LINE+14]]:3
// CHECK:STDERR: │ fn M(ref self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c.M();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' has type 'const
// CHECK:STDERR: · ┃ Carbon::RefMethodConstLValueClass' (aka 'const
// CHECK:STDERR: · ┃ Carbon::Main::RefMethodConstLValueClass'), but function is not
// CHECK:STDERR: · ┃ marked const
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.M();
}
@@ -72,7 +72,13 @@ struct VBase {
class A {}
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+2]]:1-25: error: semantics TODO: `generic class overriding methods from a C++ virtual class` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_generic.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ class GenericZ(T: type) {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `generic class overriding methods from a C++ virtual class`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class GenericZ(T: type) {
extend base: Cpp.VBase;
@@ -34,8 +34,18 @@ class PrivateClass {
inline Cpp '''
int PrivateStatic() {
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+3]]:32: error: 'x' is a private member of 'Carbon::Main::PrivateClass' [CppInteropParseError]
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-6]]:23: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_static_private.carbon:[[@LINE+13]]:32
// CHECK:STDERR: │ private static var x: i32 = 123;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::PrivateClass::x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of
// CHECK:STDERR: · ┃ 'Carbon::Main::PrivateClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return Carbon::PrivateClass::x;
}
@@ -57,7 +57,12 @@ import Cpp library "abstract.h";
class C {
extend base: Cpp.A;
// CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+2]]:3-40: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╭─┤ fail_impl_mismatch_member.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ override fn invalid(unused ref self) {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn invalid(unused ref self) {}
}
@@ -76,7 +81,13 @@ library "[[@TEST_NAME]]";
import Cpp library "abstract_final.h";
class C {
// CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+2]]:16-32: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_abstract_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.AbstractFinal;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `AbstractFinal`; base type
// CHECK:STDERR: · ┃ must be an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.AbstractFinal;
}
File diff suppressed because it is too large. Load diff
+200 -40
View File
@@ -156,71 +156,147 @@ library "[[@TEST_NAME]]";
import Cpp library "multiple_inheritance.h";
fn ConvertA(p: Cpp.C*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertB(p: Cpp.C*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -268,8 +344,16 @@ library "[[@TEST_NAME]]";
import Cpp library "virtual_inheritance.h";
fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* {
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `VirtB*` to
// CHECK:STDERR: · │ ┃ `Cpp.VirtA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.VirtB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.VirtA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -299,57 +383,121 @@ library "[[@TEST_NAME]]";
import Cpp library "diamond.h";
fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondB*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondC*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondC*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn AccessBA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondB).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondB).b;
}
fn AccessCA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondC).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondC).b;
}
fn AccessDB(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.b;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.b;
}
fn AccessDC(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.c;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.c;
}
@@ -365,7 +513,13 @@ library "[[@TEST_NAME]]";
import Cpp library "final.h";
class B {
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-25: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.FinalA;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `FinalA`; base type must be
// CHECK:STDERR: · ┃ an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.FinalA;
}
@@ -381,7 +535,13 @@ library "[[@TEST_NAME]]";
import Cpp library "union.h";
class V {
// CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+2]]:16-20: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_union.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.U;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `U`; base type must be an
// CHECK:STDERR: · ┃ `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.U;
}
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ class DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}
@@ -231,11 +241,28 @@ class Class1;
class Generic(x: Core.Copy) {
}
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:19-37: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-7]]:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-5]]:15-26: note: initializing generic parameter `x` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+23]]:19
// CHECK:STDERR: │ class Class1;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ class Generic(x: Core.Copy) {
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `x` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: argument to C++ call has incomplete type
// CHECK:STDERR: · ┃ `Cpp.Class1`
// CHECK:STDERR: · ┃ [IncompleteTypeInCopyWitness]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+2]]:15-37: warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:15
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn GenericUse(p2: Generic(Cpp.Class1)) {
}
@@ -80,8 +80,18 @@ fn G(generic T: Core.Default & Core.Destroy) {
}
fn CallG() {
// CHECK:STDERR: fail_no_default.carbon:[[@LINE+3]]:3-18: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_no_default.carbon:[[@LINE-6]]:14-43: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_no_default.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn G(generic T: Core.Default & Core.Destroy) {
// CHECK:STDERR: · ──────────────┬───────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ G(Cpp.NoDefault);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `NoDefault` into type implementing
// CHECK:STDERR: · ┃ `Core.Default & Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
G(Cpp.NoDefault);
}
@@ -208,13 +218,33 @@ library "[[@TEST_NAME]]";
import Cpp library "deleted.h";
fn F() {
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+3]]:32-52: error: call to deleted function 'DeletedC' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:4:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+12]]:32
// CHECK:STDERR: -> │ let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedC'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedC() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+4]]:32-52: error: call to deleted function 'DeletedD' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:9:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ./deleted.h:10:3: note: candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+15]]:32
// CHECK:STDERR: -> │ let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedD'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedD(int) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ DeletedD(short);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
}
@@ -283,9 +313,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:4-30: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:4
// CHECK:STDERR: -> │ Cpp.IncompleteC.IncompleteC();
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteC`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class IncompleteC;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.IncompleteC.IncompleteC();
}
@@ -95,11 +95,39 @@ fn GetF(a: Cpp.A) -> i32 { return a.f_4; }
struct BitfieldStruct {
int a;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int b : 2;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.b;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int b : 2;
};
union BitfieldUnion {
int c;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int d : 3;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.d;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int d : 3;
};
@@ -125,24 +153,16 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:4:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "with_bitfields.h";
fn F(s: Cpp.BitfieldStruct) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10-12: note: in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:9:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
return s.b;
//@dump-sem-ir-end
}
fn G(s: Cpp.BitfieldUnion) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10-12: note: in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR:
return s.d;
//@dump-sem-ir-end
}
@@ -151,6 +171,22 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
struct UnsupportedMembers {
// Volatile is not supported.
// CHECK:STDERR: ╷ ╭── included from: fail_use_unsupported_members.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./unsupported_members.h:[[@LINE+15]]:16
// CHECK:STDERR: -> │ volatile int is_volatile;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_use_unsupported_members.carbon
// CHECK:STDERR: │ let unused a: i32 = m->is_volatile;
// CHECK:STDERR: · ───────┬──────
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `is_volatile`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
volatile int is_volatile;
// But this should be fine.
int integer;
@@ -175,13 +211,9 @@ fn Test(m: Cpp.UnsupportedMembers*) {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_use_unsupported_members.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./unsupported_members.h:4:16: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "unsupported_members.h";
fn Test(m: Cpp.UnsupportedMembers*) {
// CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+2]]:23-36: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup]
// CHECK:STDERR:
let unused a: i32 = m->is_volatile;
}
@@ -16,7 +16,11 @@ library "[[@TEST_NAME]]";
import Cpp inline '''
struct Base {
// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:3: error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ no_such_type invalid;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
no_such_type invalid;
};
@@ -59,24 +59,67 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Value(v: Cpp.HasQualifiers) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-9: error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:3:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ v.plain();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void plain();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.plain();
// TODO: This should remain invalid once we support `volatile`.
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-17: error: no matching function for call to 'volatile_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:5:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.volatile_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'volatile_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void volatile_this() volatile;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.volatile_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-12: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_this();
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-16: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_ref_this();
}
@@ -89,7 +132,13 @@ import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// TODO: This should eventually be accepted if we support `volatile`.
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+2]]:3-20: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ p->volatile_this();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: parameter type: volatile struct HasQualifiers &`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->volatile_this();
}
@@ -101,15 +150,36 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:10:20-21: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ p->ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->ref_ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-23: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:11:26-27: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ p->const_ref_ref_this();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'const_ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void const_ref_ref_this() const&&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->const_ref_ref_this();
}
@@ -123,9 +193,19 @@ import Cpp library "object_param_qualifiers.h";
fn Make() -> Cpp.HasQualifiers;
fn F() {
// CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:7:16-17: note: expects an lvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Make().ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an lvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Make().ref_this();
}
@@ -200,7 +280,12 @@ struct ExplicitObjectParamUnsupported {
''';
fn Call(e: Cpp.ExplicitObjectParamUnsupported) {
// CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
}
@@ -29,8 +29,14 @@ library "[[@TEST_NAME]]";
import Cpp library "non_aggregate.h";
fn Make() {
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+3]]:3-14: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+2]]:3-14: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ var _: Cpp.X = {};
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `Cpp.X`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: Cpp.X = {};
}
@@ -41,10 +41,29 @@ import Cpp library "overload.h";
class Overload0Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has more parameters (2 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (2 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self);
}
@@ -52,10 +71,29 @@ class Overload0Params {
class Overload3Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-52: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has fewer parameters (2 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (2 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
}
@@ -70,14 +108,37 @@ import Cpp library "overload.h";
class OverloadX {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:7:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X);
}
@@ -85,14 +146,37 @@ class OverloadX {
class OverloadY {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:6:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, y: Cpp.Y);
}
@@ -65,10 +65,25 @@ import Cpp library "instantiation_error.h";
//@dump-sem-ir-begin
var x: Cpp.XY.r#type = 0;
// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+5]]:8-22: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_use_instantiation_error.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./instantiation_error.h:3:25: note: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X<int>' requested here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_use_instantiation_error.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ var y: Cpp.Xint.r#type = 0;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.X`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_instantiation_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./instantiation_error.h
// CHECK:STDERR: │ template<typename T> struct X {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'X<int>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │ using type = typename T::member;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ type 'int' cannot be used prior to '::' because it
// CHECK:STDERR: · │ has no members
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var y: Cpp.Xint.r#type = 0;
//@dump-sem-ir-end
@@ -289,11 +304,11 @@ fn G() {
// CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete]
// CHECK:STDOUT: %.loc14: type = splice_block %type.ref.loc14 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc29: type = splice_block %type.ref.loc29 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Xint.ref: type = name_ref Xint, imports.%X.decl.b67 [concrete = constants.%X.c92]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %type.ref.loc14: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: %type.ref.loc29: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var]
// CHECK:STDOUT: name_binding_decl {
@@ -312,14 +327,14 @@ fn G() {
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_1.2(%int_0.loc7) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%x.var, %.loc7
// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc14: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc14_1.1: <bound method> = bound_method %int_0.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc14_1.2: <bound method> = bound_method %int_0.loc14, %specific_fn.loc14 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_1.2(%int_0.loc14) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc14: init %i32 = converted %int_0.loc14, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc14
// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc29_1.1: <bound method> = bound_method %int_0.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc29: <specific function> = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc29_1.2: <bound method> = bound_method %int_0.loc29, %specific_fn.loc29 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_1.2(%int_0.loc29) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc29: init %i32 = converted %int_0.loc29, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc29
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ union DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}