Start every diagnostic with a single message attached to the code (#8102)

This is the final step in landing the _structural_ updates to diagnostic
rendering.

The key idea here is that we want the primary diagnostic to have a
message clearly explaining the problem and attached to the code that has
that problem. This should be the starting point for readers working to
address the issue, but is rendered attached to the code snippet in
question so errors are always "in context" of the code with the error.
Everything else in a diagnostic is an additional label attached to code
to explain or help the reader understand the problem in the primary
message.

Previously, `ContextScope` resulted in some confusion here, as
diagnostic consumers turned messages into labels and made the message in
the context scope the message. In essence, this isn't a scope with
context _for_ a diagnostic (with two exceptions that should probably
have been an `AnnotationScope`), but a context within `check` where we
have a preferred message for a diagnostic emitted by general purpose
code we call into. For example, "class was forward declared here" starts
as an error, and then consumers render it as a label to make the message
from the context scope the error. We also grew an `AnnotationScope` to
handle the contextual information we want to show for a diagnostic (what
I would have assumed `ContextScope` actually did).

Now we have a `Diagnoser`: code in `check` that can better explain the
problem than shared logic it is calling into passes a callback that
builds a caller-specific diagnostic. The callee then can attach relevant
labels and emit it. Diagnostics no longer store `contexts` and consumers
no longer need the logic to restructure things. We move all (but two) of
the old contexts to be normal messages emitted in this way, and we move
some diagnostics to become labels. Each of the new normal messages
corresponds to a new diagnostic kind as usual. Common code following
this pattern now _requires_ the `Diagnoser` to be passed (or emit
nothing), and this uncovered three places where an empty context was
used that made the rendered form miss key information. All three are
fixed with new diagnostics, one already covered by tests, and two with
TODOs to add test coverage.

We also completely remove the old `ContextScope` and
`CARBON_DIAGNOSTIC_CONTEXT` and rename `AnnotationScope` to
`ContextScope`. It is only used to attach information about when/where a
diagnostic occurred.

Labels also no longer have categories. What were `Primary` are now
`ExtraRange`s on the diagnostic rather than labels. Labels are now
always informational.

`DeclaredName` now narrows the range of a label when the range is a
declaration of a named entity to only be the range of that name. For
entities that don't have a declared name, the entire declaration remains
the range. The code building and emitting these diagnostics can skip
them if the declared location isn't distinct from the diagnostic
location.

Wording is largely unchanged here so we can just review the _structural_
change. #7991 iterates using this to improve locations and adds missing
labels. A subsequent PR will iterate on the wording to increasingly fit
within this structural model.

This is separated out as a way to review incrementally, and so that
subsequently we don't have to review wording improvements that only make
sense in a new structure that you cannot see yet. It seems easier to
look at the structure here even with awkward wording.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-22 05:19:35 +00:00
1 parent 4729b4473b
commit 0072b28129
378 files changed
+5795 -6998

No files matched your search

@@ -544,7 +544,7 @@ void f(const int n) {
// CHECK:STDERR: · ╰──┤ variable 'n' declared const here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ ++n;
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┳ ━
// CHECK:STDERR: · ┗━━┫ error: cannot assign to variable 'n' with const-qualified type 'const
// CHECK:STDERR: · ┃ int'
// CHECK:STDERR: · ┃ [CppInteropParseError]
@@ -89,14 +89,13 @@ namespace A {
fn TryToUseNotLeaked() {
// TODO: Clang's diagnostic for using a class whose definition is not
// reachable is confusing.
// CHECK:STDERR: ╭─┤ fail_not_leaked.carbon:[[@LINE+14]]:17
// CHECK:STDERR: ╭─┤ fail_not_leaked.carbon:[[@LINE+13]]:17
// CHECK:STDERR: -> │ var unused x: Cpp.A.X = 0;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `X` in name
// CHECK:STDERR: · ┃ binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: direct_import.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./shared.h
// CHECK:STDERR: │ struct X {
// CHECK:STDERR: · ┬
@@ -150,7 +150,7 @@ namespace N;
inline Cpp '''
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:23
// CHECK:STDERR: -> │ using Leak1 = Carbon::ExportedClass;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedClass' in namespace
// CHECK:STDERR: · ┃ 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
@@ -159,7 +159,7 @@ inline Cpp '''
using Leak1 = Carbon::ExportedClass;
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ using Leak2 = Carbon::N::ExportedNested;
// CHECK:STDERR: · ──────────╴╻
// CHECK:STDERR: · ━━━━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedNested' in namespace
// CHECK:STDERR: · ┃ 'Carbon::N'
// CHECK:STDERR: · ┃ [CppInteropParseError]
@@ -168,7 +168,7 @@ using Leak1 = Carbon::ExportedClass;
using Leak2 = Carbon::N::ExportedNested;
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ using Leak3 = Carbon::PkgA::SameName;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'PkgA' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -37,7 +37,7 @@ void F() {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
@@ -104,7 +104,7 @@ void F() {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
@@ -141,7 +141,7 @@ void F() {
// 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+7]]:5
// CHECK:STDERR: -> │ b.F();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'F' in 'Carbon::Main::B<Carbon::Main::A>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
+15 -15
View File
@@ -97,9 +97,9 @@ struct VirtualDestructor {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithVdtor {
@@ -151,9 +151,9 @@ import Cpp;
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractNonvirtualDtor {}
@@ -179,9 +179,9 @@ import Cpp;
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethodNoVptr {
@@ -210,9 +210,9 @@ import Cpp;
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethod {
@@ -256,9 +256,9 @@ import Cpp;
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractToOverride {
@@ -59,16 +59,21 @@ library "[[@TEST_NAME]]";
import Cpp;
// 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+27]]:50
// CHECK:STDERR: │ class IncompleteConcreteA;
// CHECK:STDERR: · ─────────┬─────────
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::IncompleteConcreteA incomplete_concrete_a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: use of incomplete Carbon type `IncompleteConcreteA`
// CHECK:STDERR: · ┃ [IncompleteTypeInCppUse]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+15]]:29
// CHECK:STDERR: │ class IncompleteConcreteA;
// CHECK:STDERR: · ┬
@@ -116,7 +121,7 @@ inline Cpp '''
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:9
// CHECK:STDERR: -> │ Carbon::T t;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'T' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -77,7 +77,7 @@ void AccessNonexistentField() {
Carbon::EmptyClass a;
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -85,7 +85,7 @@ void AccessNonexistentField() {
a.x = 12;
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y = 34;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -122,7 +122,7 @@ void AccessUnsupportedField() {
Carbon::UnsupportedFieldType a;
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -130,7 +130,7 @@ void AccessUnsupportedField() {
a.x;
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -152,7 +152,7 @@ void AccessAdaptedField() {
Carbon::AdaptedClass a;
// CHECK:STDERR: ╭─┤ fail_adapter.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::AdaptedClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -68,7 +68,7 @@ void FUnsupported() {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'AliasEmptyTuple' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -99,7 +99,7 @@ void FMethodCall() {
Carbon::ClassWithMethod<int> c;
// CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ c.M();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'M' in 'Carbon::Main::ClassWithMethod<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
File diff suppressed because it is too large. Load diff
+59 -114
View File
@@ -156,146 +156,118 @@ 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+9]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]: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: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.A*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertB(p: Cpp.C*) -> Cpp.B* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+7]]: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: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.B*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ `Cpp.Empty1*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ `Cpp.Empty2*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ to `Cpp.A*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ to `Cpp.B*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ to `Cpp.A*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ to `Cpp.B*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic1*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* {
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+8]]: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: · ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic2*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
@@ -344,15 +316,12 @@ 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+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_virtual_inheritance.carbon:[[@LINE+8]]: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: · ┃ `Cpp.VirtA*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
@@ -383,120 +352,96 @@ library "[[@TEST_NAME]]";
import Cpp library "diamond.h";
fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondB*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondC*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn AccessBA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondB` with `as`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondB).b;
}
fn AccessCA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondC` with `as`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondC).b;
}
fn AccessDB(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondB`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.b;
}
fn AccessDC(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+8]]: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: · ┃ `Cpp.DiamondC`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.c;
@@ -35,14 +35,13 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+13]]: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: · ┬
@@ -313,13 +313,12 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:4
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+12]]: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: · ┬
@@ -29,13 +29,11 @@ library "[[@TEST_NAME]]";
import Cpp library "non_aggregate.h";
fn Make() {
// CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+7]]: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: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: Cpp.X = {};
@@ -108,30 +108,24 @@ import Cpp library "overload.h";
class OverloadX {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+26]]: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: · │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+16]]: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: · │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(Y y);
@@ -146,30 +140,24 @@ class OverloadX {
class OverloadY {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+26]]: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: · │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+16]]: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: · │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
@@ -46,6 +46,26 @@ fn G(p: Cpp.Ai16*) -> Cpp.Base* {
// --- instantiation_error.h
template<typename T> struct X {
// CHECK:STDERR: ╷ ╭── included from: fail_use_instantiation_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./instantiation_error.h:[[@LINE+19]]:25
// 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: ┆
// CHECK:STDERR: -> │ using type = typename T::member;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: type 'int' cannot be used prior to '::'
// CHECK:STDERR: · ┃ because it has no members
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_use_instantiation_error.carbon
// CHECK:STDERR: │ var y: Cpp.Xint.r#type = 0;
// CHECK:STDERR: · ───────┬───────
// CHECK:STDERR: · ╰──┤ in completion of type `Cpp.X` here [InTypeCompletion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using type = typename T::member;
};
@@ -65,26 +85,6 @@ 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+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
@@ -304,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: %.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: %.loc9: type = splice_block %type.ref.loc9 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc9: <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.loc29: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: %type.ref.loc9: 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 {
@@ -327,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.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: %int_0.loc9: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc9: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc9_1.1: <bound method> = bound_method %int_0.loc9, %impl.elem0.loc9 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc9: <specific function> = specific_function %impl.elem0.loc9, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc9_1.2: <bound method> = bound_method %int_0.loc9, %specific_fn.loc9 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9: init %i32 = call %bound_method.loc9_1.2(%int_0.loc9) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc9: init %i32 = converted %int_0.loc9, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc9 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc9
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -35,14 +35,13 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+13]]: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: · ┬
+4 -7
View File
@@ -37,21 +37,18 @@ const S& Get();
''';
fn F() {
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+17]]:3
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.Get().x = 123;
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ Cpp.Get().x = 123;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `const i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(const i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `const i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Get().x = 123;
+11 -22
View File
@@ -39,59 +39,48 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.Enum.a as i8;
// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i8` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i8)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Enum.a as i8;
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.Enum.a as i32;
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i32` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Enum.a as i32;
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ (42 as i8) as Cpp.Enum;
// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i8` to `Cpp.Enum` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i8` does not implement interface `Core.As(Cpp.Enum)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
(42 as i8) as Cpp.Enum;
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ (42 as i32) as Cpp.Enum;
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i32` to `Cpp.Enum` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.As(Cpp.Enum)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
(42 as i32) as Cpp.Enum;
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ Cpp.a as Cpp.DifferentSize;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to
// CHECK:STDERR: · │ ┃ `Cpp.DifferentSize` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DifferentSize)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Cpp.DifferentSize` with `as`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.a as Cpp.DifferentSize;
+3 -3
View File
@@ -78,9 +78,9 @@ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool {
fn CompareHeterogeneousFail(x: Cpp.Scoped, y: Cpp.Unscoped) -> bool {
// CHECK:STDERR: ╭─┤ fail_heterogeneous.carbon:[[@LINE+13]]:10
// CHECK:STDERR: │ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───────┬──────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return CompareGeneric(x, y);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
@@ -52,14 +52,13 @@ import Cpp library "declaration.h";
fn MyF() {
// TODO: It's a bit surprising to refer to this type as a class, even though
// we model it as a class in Carbon. Consider customizing the diagnostic.
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:17
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+13]]:17
// CHECK:STDERR: -> │ var unused e: Cpp.UnsizedEnum;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `UnsizedEnum` 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: │ enum UnsizedEnum;
// CHECK:STDERR: · ┬
+6 -12
View File
@@ -36,28 +36,22 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:29
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+8]]:29
// CHECK:STDERR: -> │ let unused c: Cpp.Other = Cpp.Enum.c;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.Other = Cpp.Enum.c;
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:30
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+8]]:30
// CHECK:STDERR: -> │ let unused c2: Cpp.Other = Cpp.c;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c2: Cpp.Other = Cpp.c;
@@ -68,7 +68,7 @@ int GArrayVarParam() {
// CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
// CHECK:STDERR: · ┳─────────────────────
// CHECK:STDERR: · ┳───────━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayVarParam' in namespace 'Carbon'; did
// CHECK:STDERR: · │ ┃ you mean 'GArrayVarParam'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
@@ -81,7 +81,7 @@ int GArrayVarParam() {
// CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
// CHECK:STDERR: · ────────────── ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ━━━━━━━━━━━━━━ ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: too many arguments to function call,
// CHECK:STDERR: · ┃ expected 0, have 1
// CHECK:STDERR: · ┃ [CppInteropParseError]
@@ -120,7 +120,7 @@ int GArrayReturn() {
// CHECK:STDERR: · ╰──┤ 'GArrayReturn' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto &&arr = Carbon::FArrayReturn();
// CHECK:STDERR: · ┳───────────────────
// CHECK:STDERR: · ┳───────━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayReturn' in namespace 'Carbon';
// CHECK:STDERR: · │ ┃ did you mean 'GArrayReturn'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
@@ -130,7 +130,7 @@ int GArrayReturn() {
auto &&arr = Carbon::FArrayReturn();
// CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+7]]:13
// CHECK:STDERR: -> │ return arr[0];
// CHECK:STDERR: · ──╴╻╶
// CHECK:STDERR: · ━━╸╻╺
// CHECK:STDERR: · ┗━━┫ error: subscripted value is not an array, pointer, or vector
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -53,7 +53,7 @@ void CallFactoryIsMethod() {
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryIsMethod a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┳ ━━
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for initialization
// CHECK:STDERR: · ┃ of 'Carbon::FactoryIsMethod' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::FactoryIsMethod')
@@ -94,7 +94,7 @@ void CallFactoryDoesntReturnSelf() {
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryDoesntReturnSelf a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┳ ━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: no matching constructor for initialization of
// CHECK:STDERR: · ┃ 'Carbon::FactoryDoesntReturnSelf' (aka
@@ -136,7 +136,7 @@ void CallFactoryReturnsByRef() {
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryReturnsByRef a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┳ ━━
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::FactoryReturnsByRef' (aka
@@ -187,7 +187,7 @@ void CallGenericConstructor() {
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::GenericConstructor b(0);
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┳ ━
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::GenericConstructor' (aka
@@ -231,7 +231,7 @@ void CallGenericClass() {
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::GenericClass<int> c(0);
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┳ ━
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::GenericClass<int>'
@@ -90,12 +90,11 @@ void CallUsingF() { UsingF(); }
package OtherGeneric;
// CHECK:STDERR: ╷ ╭── imported from: fail_todo_generic.carbon [InImport]
// CHECK:STDERR: ├─┤ other_generic.carbon:[[@LINE+8]]:1
// CHECK:STDERR: ├─┤ other_generic.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ fn HasGenericArg(generic T: type, a: T) { a; }
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments
// CHECK:STDERR: · │ ┃ [CallArgCountMismatch]
// CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity]
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn HasGenericArg(generic T: type, a: T) { a; }
@@ -142,7 +142,7 @@ void CallEnclosingF() {
Carbon::EnclosingB b;
// CHECK:STDERR: ╭─┤ fail_todo_enclosing_generic.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ b.MemberF(1, 2);
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ━ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'MemberF' in 'Carbon::Main::EnclosingA<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -309,14 +309,12 @@ library "[[@TEST_NAME]]";
import Cpp library "short_param.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_short_param_int32_arg.carbon:[[@LINE+15]]:11
// CHECK:STDERR: ╭─┤ fail_import_short_param_int32_arg.carbon:[[@LINE+13]]:11
// CHECK:STDERR: -> │ Cpp.foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to
// CHECK:STDERR: · │ ┃ `i16`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(i16)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `i16`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./short_param.h
// CHECK:STDERR: │ auto foo(short a) -> void;
@@ -62,14 +62,13 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredClass*) {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:23
// CHECK:STDERR: -> │ Cpp.foo_decl_param1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
@@ -82,14 +81,13 @@ fn F(p: Cpp.ForwardDeclaredClass*) {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo_decl_param1(*p);
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:23
// CHECK:STDERR: -> │ Cpp.foo_decl_param2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
@@ -479,13 +477,12 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+12]]:3
// CHECK:STDERR: -> │ Cpp.Incomplete.foo();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
@@ -575,13 +572,12 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+17]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ class DeclValueReturnClass;
// CHECK:STDERR: · ┬
@@ -74,15 +74,12 @@ fn F() {
// CHECK:STDERR:
Cpp.TakesFunction(&n[0]);
// CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+17]]:21
// CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+14]]:21
// CHECK:STDERR: -> │ Cpp.TakesFunction(Cpp.nullptr);
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Cpp.nullptr_t` to `<C++ type int (*)(int)>`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.nullptr_t` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(<C++ type int (*)(int)>)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Cpp.nullptr_t` to `<C++ type int (*)(int)>`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./params.h
// CHECK:STDERR: │ void TakesFunction(int f(int));
@@ -917,12 +914,12 @@ fn F() {
// CHECK:STDOUT: %.loc36_24.2: %i32 = converted %int_0, %.loc36_24.1 [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc36_25: ref %i32 = array_index %n.ref, %.loc36_24.2
// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc36_25
// CHECK:STDOUT: %Cpp.ref.loc55_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc55: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc55_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc52_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc52: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc52_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit]
// CHECK:STDOUT: %.loc55: %.659 = converted %nullptr.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc52: %.659 = converted %nullptr.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %TakesFunction.call: init %empty_tuple.type = call imports.%TakesFunction.decl(<error>)
// CHECK:STDOUT: %Destroy.facet.loc20_3.1: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %.loc20_3.2: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc20_3.1 [concrete = constants.%Destroy.facet.843]
@@ -165,13 +165,12 @@ library "[[@TEST_NAME]]";
import Cpp library "forward_decl.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_use_forward_decl.carbon:[[@LINE+16]]:3
// CHECK:STDERR: ╭─┤ fail_use_forward_decl.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.ReturnCallback()();
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_forward_decl.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./forward_decl.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
@@ -75,7 +75,7 @@ library "[[@TEST_NAME]]";
import Cpp library "method_ptr.h";
fn F(c: Cpp.C) {
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+39]]:3
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+36]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name of type `<C++ type void (C::*)(void) const>` in
@@ -84,7 +84,7 @@ fn F(c: Cpp.C) {
// CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+30]]:3
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+27]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
@@ -97,21 +97,18 @@ fn F(c: Cpp.C) {
// CHECK:STDERR: · ┃ function pointer
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon:[[@LINE+17]]:3
// CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon:[[@LINE+14]]:3
// CHECK:STDERR: │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ─────────────┬────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function pointer type used here
// CHECK:STDERR: · │ [InCppFunctionPointerThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 0 arguments
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon
// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.(Cpp.GetMethodPtr())(42);
@@ -283,7 +283,7 @@ import Cpp library "struct_init.h";
fn MakeThreeFields() -> {.a: i32, .b: i32, .c: i32};
fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: i32, .c: i32}) {
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+16]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
@@ -291,10 +291,6 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR: · ┃ `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does
// CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -305,17 +301,13 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR:
Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+15]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -326,17 +318,13 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR:
Cpp.PassThreeFields(value);
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+15]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -347,17 +335,13 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR:
Cpp.PassThreeFields(reference);
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+15]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -368,7 +352,7 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR:
Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+16]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
@@ -376,10 +360,6 @@ fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b:
// CHECK:STDERR: · ┃ `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does
// CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -462,15 +442,12 @@ import Cpp library "struct_init.h";
fn MakeEmpty() -> ();
fn Empty(value: (), ref reference: ()) {
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ to `Cpp.NoFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
@@ -481,15 +458,12 @@ fn Empty(value: (), ref reference: ()) {
// CHECK:STDERR:
Cpp.PassNoFields(());
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ to `Cpp.NoFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
@@ -500,15 +474,12 @@ fn Empty(value: (), ref reference: ()) {
// CHECK:STDERR:
Cpp.PassNoFields(value);
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ to `Cpp.NoFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
@@ -519,15 +490,12 @@ fn Empty(value: (), ref reference: ()) {
// CHECK:STDERR:
Cpp.PassNoFields(reference);
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(MakeEmpty());
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ to `Cpp.NoFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
@@ -542,19 +510,14 @@ fn Empty(value: (), ref reference: ()) {
fn MakeThreeFields() -> (i32, i32, i32);
fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+21]]:23
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+16]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields((1, 2, 3));
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ━━━━┳━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type
// CHECK:STDERR: · │ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -565,15 +528,12 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
// CHECK:STDERR:
Cpp.PassThreeFields((1, 2, 3));
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -584,15 +544,12 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
// CHECK:STDERR:
Cpp.PassThreeFields(value);
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -603,15 +560,12 @@ fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
// CHECK:STDERR:
Cpp.PassThreeFields(reference);
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+14]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
@@ -641,15 +595,12 @@ import Cpp library "int_from_struct.h";
fn F() {
// C++ permits `{}` to be used to initialize an int, but Carbon does not.
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+13]]:15
// CHECK:STDERR: -> │ Cpp.PassInt({});
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to
// CHECK:STDERR: · │ ┃ `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassInt(int n) -> void;
@@ -659,15 +610,12 @@ fn F() {
// CHECK:STDERR:
Cpp.PassInt({});
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+13]]:15
// CHECK:STDERR: -> │ Cpp.PassInt(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to
// CHECK:STDERR: · │ ┃ `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassInt(int n) -> void;
@@ -688,15 +636,12 @@ fn F() {
// C++ overload resolution prefers to convert `{}` to `int` rather than to an
// empty struct. So that's the overload we pick, even though we can't call it.
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+14]]:22
// CHECK:STDERR: -> │ Cpp.PassOverloaded({});
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{}` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `{}` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassOverloaded(int n) -> void;
@@ -707,15 +652,12 @@ fn F() {
// CHECK:STDERR:
Cpp.PassOverloaded({});
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+14]]:22
// CHECK:STDERR: -> │ Cpp.PassOverloaded(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `()` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `()` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassOverloaded(int n) -> void;
@@ -771,7 +713,7 @@ library "[[@TEST_NAME]]";
import Cpp library "nested_structs.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_todo_pass_nested_structs.carbon:[[@LINE+19]]:13
// CHECK:STDERR: ╭─┤ fail_todo_pass_nested_structs.carbon:[[@LINE+15]]:13
// CHECK:STDERR: -> │ Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛
@@ -779,10 +721,6 @@ fn F() {
// CHECK:STDERR: · ┃ `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}`
// CHECK:STDERR: · ┃ to `Cpp.B`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭──────────────────────────╯
// CHECK:STDERR: · │ type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface `Core.ImplicitAs(Cpp.B)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./nested_structs.h
// CHECK:STDERR: │ void TakeB(B);
@@ -822,15 +760,12 @@ library "[[@TEST_NAME]]";
import Cpp library "signedness_change.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_signedness_change_rejected.carbon:[[@LINE+17]]:22
// CHECK:STDERR: ╭─┤ fail_signedness_change_rejected.carbon:[[@LINE+14]]:22
// CHECK:STDERR: -> │ Cpp.signedness_foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `i32` to `u32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(u32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `i32` to `u32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./signedness_change.h
// CHECK:STDERR: │ auto signedness_foo(unsigned int a) -> void;
@@ -853,15 +788,12 @@ library "[[@TEST_NAME]]";
import Cpp library "downsizing_rejected.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_downsizing_rejected.carbon:[[@LINE+17]]:22
// CHECK:STDERR: ╭─┤ fail_import_downsizing_rejected.carbon:[[@LINE+14]]:22
// CHECK:STDERR: -> │ Cpp.downsizing_foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `i32` to `i16`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i16)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `i32` to `i16`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./downsizing_rejected.h
// CHECK:STDERR: │ auto downsizing_foo(short a) -> void;
@@ -989,9 +921,9 @@ fn EchoValue[ValueT: I](unused generic value: ValueT) {}
fn F() {
// CHECK:STDERR: ╭─┤ fail_missing_impl.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EchoValue[ValueT: I](unused generic value: ValueT) {}
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ────┬────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EchoValue(Cpp.missing_impl_foo);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -425,7 +425,7 @@ import Cpp library "deduced_pointer_param.h";
fn F() {
// This could return a null pointer, so should not be given the type `Cpp.DeducedPointerS*`.
// CHECK:STDERR: ╭─┤ fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+14]]:40
// CHECK:STDERR: ╭─┤ fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+10]]:40
// CHECK:STDERR: -> │ let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
@@ -433,10 +433,6 @@ fn F() {
// CHECK:STDERR: · ┃ `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to
// CHECK:STDERR: · ┃ `Cpp.DeducedPointerS*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────╯
// CHECK:STDERR: · │ type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS);
@@ -461,15 +461,12 @@ library "[[@TEST_NAME]]";
import Cpp library "return_const_lvalue_ref.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+11]]:29
// CHECK:STDERR: ╭─┤ fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+8]]:29
// CHECK:STDERR: -> │ let unused ref s: Cpp.S = Cpp.ReturnConstLValue();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `const Cpp.S` to `Cpp.S`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `const Cpp.S` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.S)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `const Cpp.S` to `Cpp.S`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused ref s: Cpp.S = Cpp.ReturnConstLValue();
@@ -62,14 +62,13 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredStruct*) {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:12
// CHECK:STDERR: -> │ Cpp.foo1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
@@ -82,14 +81,13 @@ fn F(p: Cpp.ForwardDeclaredStruct*) {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo1(*p);
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:12
// CHECK:STDERR: -> │ Cpp.foo2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
@@ -350,13 +348,12 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+12]]:3
// CHECK:STDERR: -> │ Cpp.IncompleteStruct.foo();
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteStruct`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ struct IncompleteStruct;
// CHECK:STDERR: · ┬
@@ -447,13 +444,12 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+17]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ struct DeclValueReturnStruct;
// CHECK:STDERR: · ┬
@@ -62,14 +62,13 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredUnion*) {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:12
// CHECK:STDERR: -> │ Cpp.foo1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
@@ -82,14 +81,13 @@ fn F(p: Cpp.ForwardDeclaredUnion*) {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo1(*p);
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+18]]:12
// CHECK:STDERR: -> │ Cpp.foo2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
@@ -306,13 +304,12 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+12]]:3
// CHECK:STDERR: -> │ Cpp.IncompleteUnion.foo();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteUnion`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ union IncompleteUnion;
// CHECK:STDERR: · ┬
@@ -402,13 +399,12 @@ library "[[@TEST_NAME]]";
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+17]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ union DeclValueReturnUnion;
// CHECK:STDERR: · ┬
+22 -26
View File
@@ -112,18 +112,14 @@ import Cpp library "conversions.h";
fn ConstructorExplicit(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+14]]:42
// CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+10]]:42
// CHECK:STDERR: -> │ let _: Cpp.ConditionallyExplicitTrue = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source`
// CHECK:STDERR: · │ ┃ to
// CHECK:STDERR: · │ ┃ `Cpp.ConditionallyExplicit`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭────────────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ConditionallyExplicit)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source`
// CHECK:STDERR: · ┃ to
// CHECK:STDERR: · ┃ `Cpp.ConditionallyExplicit`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ConditionallyExplicitTrue = s;
@@ -571,9 +567,9 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) {
// CHECK:STDOUT: fn @ConstructorExplicit(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc22_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc22_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc18_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc18_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %ConditionallyExplicitTrue.ref: type = name_ref ConditionallyExplicitTrue, imports.%ConditionallyExplicit.decl.6ab [concrete = constants.%ConditionallyExplicit.9d4]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %ConditionallyExplicit.9d4 = wrapper_binding _, <error> [concrete = <error>]
@@ -586,27 +582,27 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) {
// CHECK:STDOUT: fn @ConversionExplicit(%s.param: %ConditionallyExplicit.3cd) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %ConditionallyExplicit.3cd = name_ref s, %s
// CHECK:STDOUT: %.loc28_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc28_21.1
// CHECK:STDOUT: %.loc24_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc24_21.1
// CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr)
// CHECK:STDOUT: %.loc28_21.2: init %Dest.980 to %.loc28_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc28_21.3: init %Dest.980 = converted %s.ref, %.loc28_21.2
// CHECK:STDOUT: %.loc28_21.4: ref %Dest.980 = temporary %.loc28_21.1, %.loc28_21.3
// CHECK:STDOUT: %.loc28_21.5: %Dest.980 = acquire_value %.loc28_21.4
// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc28: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc24_21.2: init %Dest.980 to %.loc24_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc24_21.3: init %Dest.980 = converted %s.ref, %.loc24_21.2
// CHECK:STDOUT: %.loc24_21.4: ref %Dest.980 = temporary %.loc24_21.1, %.loc24_21.3
// CHECK:STDOUT: %.loc24_21.5: %Dest.980 = acquire_value %.loc24_21.4
// CHECK:STDOUT: %.loc24_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc28_21.5
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc24_21.5
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc28_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc28_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc24_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc24_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_21.4)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_21.4)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+4 -9
View File
@@ -134,13 +134,11 @@ fn CopyDeletedMove(c: Cpp.DeletedMove) -> Cpp.DeletedMove {
fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy {
// TODO: List candidates here.
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+9]]:10
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+7]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `NonConstCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstCopy` does not implement interface `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [CopyOfUncopyableType]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
@@ -148,14 +146,11 @@ fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy {
fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy {
// TODO: List candidates here.
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+10]]:10
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+7]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AmbiguousCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.AmbiguousCopy` does not implement interface
// CHECK:STDERR: · │ `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [CopyOfUncopyableType]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
+74 -75
View File
@@ -91,9 +91,9 @@ fn DestroyClassWithProtectedBaseDestructor() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
@@ -113,7 +113,7 @@ class Derived {
fn DestroyClassWithPrivateBaseDestructor() {
//@dump-sem-ir-begin
// TODO: We should not allow this, as the destructor of the base class is private.
// CHECK:STDERR: ╭─┤ fail_destroy_private_base_destructor.carbon:[[@LINE+19]]:3
// CHECK:STDERR: ╭─┤ fail_destroy_private_base_destructor.carbon:[[@LINE+43]]:3
// CHECK:STDERR: -> │ var unused a: Derived = {.base = {}};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `<C++ destructor>` of type
@@ -127,9 +127,33 @@ fn DestroyClassWithPrivateBaseDestructor() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╷ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./types.h:13:7
// CHECK:STDERR: -> │ class AmbiguousDestructorT {
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: destructor of class 'AmbiguousDestructorT<>' is ambiguous
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ in instantiation of template class 'AmbiguousDestructorT<>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │ public:
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_destroy_nondestroyable.carbon
// CHECK:STDERR: │ var unused a: Cpp.AmbiguousDestructor = {};
// CHECK:STDERR: · ──────┬────────────────
// CHECK:STDERR: · ╰──┤ in completion of type `Cpp.AmbiguousDestructorT` here
// CHECK:STDERR: · │ [InTypeCompletion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
@@ -143,31 +167,6 @@ library "[[@TEST_NAME]]";
import Cpp library "types.h";
fn AmbiguousDestroy() {
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+25]]:17
// CHECK:STDERR: -> │ var unused a: Cpp.AmbiguousDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type
// CHECK:STDERR: · ┃ `AmbiguousDestructor` in name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ class AmbiguousDestructorT {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'AmbiguousDestructorT<>' requested
// CHECK:STDERR: · │ │ here
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ destructor of class 'AmbiguousDestructorT<>' is ambiguous
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: │ public:
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.AmbiguousDestructor = {};
}
@@ -185,9 +184,9 @@ fn DeletedDestroy() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+14]]:3
@@ -199,9 +198,9 @@ fn DeletedDestroy() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.DeletedDestructor = {};
@@ -222,9 +221,9 @@ fn PrivateDestroy() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.PrivateDestructor = {};
@@ -245,9 +244,9 @@ fn ProtectedDestroy() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.ProtectedDestructor = {};
@@ -299,9 +298,9 @@ fn F() {
// 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: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: AdaptNoDestroy = Make();
@@ -609,7 +608,7 @@ fn F() {
// CHECK:STDOUT: %SubobjectDestroy.facet.be1: %SubobjectDestroy.type = facet_value %PrivateDestructor, (%custom_witness.fe1) [concrete]
// CHECK:STDOUT: %DestroyImpl.impl_witness.a8a: <witness> = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.be1) [concrete]
// CHECK:STDOUT: %Destroy.facet.75a: %Destroy.type = facet_value %PrivateDestructor, (%DestroyImpl.impl_witness.a8a, %custom_witness.fe1) [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc56_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete]
@@ -625,52 +624,52 @@ fn F() {
// CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt
// CHECK:STDOUT: %.loc32_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc32_38.1: %struct_type.base.f5e = struct_literal (%.loc32_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc32_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc32_37.2: init %.c73 to %.loc32_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.3: init %.c73 = converted %.loc32_37.1, %.loc32_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.4: init %PrivateDestructor = as_compatible %.loc32_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc32_38.5: init %Derived to %a.var = class_init (%.loc32_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc32_3.1: init %Derived = converted %.loc32_38.1, %.loc32_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc32_3.1
// CHECK:STDOUT: %.loc56_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc56_38.1: %struct_type.base.f5e = struct_literal (%.loc56_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc56_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc56_37.2: init %.c73 to %.loc56_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc56_38.3: init %.c73 = converted %.loc56_37.1, %.loc56_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc56_38.4: init %PrivateDestructor = as_compatible %.loc56_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc56_38.5: init %Derived to %a.var = class_init (%.loc56_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc56_3.1: init %Derived = converted %.loc56_38.1, %.loc56_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc56_3.1
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
// CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt]
// CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc56_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc56_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc56_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7]
// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc56_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc56_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc56_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc56_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc56_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
+149 -201
View File
@@ -92,15 +92,12 @@ import Cpp library "implicit_conversions.h";
fn NonConstConversionTest(s: Cpp.NonConstConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `NonConstConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `NonConstConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -161,17 +158,13 @@ import Cpp library "implicit_conversions.h";
fn DeletedConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+13]]:35
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+9]]:35
// CHECK:STDERR: -> │ let _: Cpp.DeletedConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.DeletedConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DeletedConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source` to
// CHECK:STDERR: · ┃ `Cpp.DeletedConstructor`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.DeletedConstructor = s;
@@ -180,15 +173,12 @@ fn DeletedConstructorTest(s: Cpp.Source) {
fn DeletedConversionTest(s: Cpp.DeletedConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `DeletedConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DeletedConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `DeletedConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -203,17 +193,13 @@ import Cpp library "implicit_conversions.h";
fn ExplicitConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+13]]:36
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+9]]:36
// CHECK:STDERR: -> │ let _: Cpp.ExplicitConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.ExplicitConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭──────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ExplicitConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `Source` to
// CHECK:STDERR: · ┃ `Cpp.ExplicitConstructor`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ExplicitConstructor = s;
@@ -222,15 +208,12 @@ fn ExplicitConstructorTest(s: Cpp.Source) {
fn ExplicitConversionTest(s: Cpp.ExplicitConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+11]]:21
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `ExplicitConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.ExplicitConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `ExplicitConversion` to `Cpp.Dest`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
@@ -257,15 +240,12 @@ import Cpp library "implicit_conversions.h";
fn IntConstructorTest(u: u32) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+16]]:31
// CHECK:STDERR: ╭─┤ fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+13]]:31
// CHECK:STDERR: -> │ let _: Cpp.IntConstructor = u;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `u32` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `u32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ of type `u32` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./implicit_conversions.h
// CHECK:STDERR: │ IntConstructor(int);
@@ -341,42 +321,32 @@ import Cpp library "aggregate.h";
fn InitFromTuple() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = ();
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `()` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `()` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = ();
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+12]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: · ┳━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral,)` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral,)` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `(Core.IntLiteral,)` to
// CHECK:STDERR: · ┃ `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+13]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1, 2);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · │ ┃ to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral, Core.IntLiteral)` does
// CHECK:STDERR: · │ not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `(Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · ┃ to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1, 2);
@@ -391,42 +361,32 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{}` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {};
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+12]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+13]]:26
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+9]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1, .y = 2};
@@ -455,44 +415,32 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+11]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+8]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{}` to `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {};
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+13]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+9]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+14]]:29
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+9]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type
// CHECK:STDERR: · │ `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1, .y = 2};
@@ -680,9 +628,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @NonConstConversionTest(%s.param: %NonConstConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %NonConstConversion = name_ref s, %s
// CHECK:STDOUT: %.loc19_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc16_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -844,9 +792,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc21_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc17_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc17_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %DeletedConstructor.ref: type = name_ref DeletedConstructor, imports.%DeletedConstructor.decl [concrete = constants.%DeletedConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %DeletedConstructor = wrapper_binding _, <error> [concrete = <error>]
@@ -859,9 +807,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConversionTest(%s.param: %DeletedConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %DeletedConversion = name_ref s, %s
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc31_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc31_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -902,9 +850,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc21_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc17_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc17_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %ExplicitConstructor.ref: type = name_ref ExplicitConstructor, imports.%ExplicitConstructor.decl [concrete = constants.%ExplicitConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %ExplicitConstructor = wrapper_binding _, <error> [concrete = <error>]
@@ -917,9 +865,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConversionTest(%s.param: %ExplicitConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %ExplicitConversion = name_ref s, %s
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc31_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc31_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -1042,28 +990,28 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @IntConstructorTest(%u.param: %u32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %u.ref: %u32 = name_ref u, %u
// CHECK:STDOUT: %.loc24_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc24_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc24_31.1
// CHECK:STDOUT: %.loc21_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc21_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc21_31.1
// CHECK:STDOUT: %IntConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%IntConstructor__carbon_thunk.decl(<error>, %addr)
// CHECK:STDOUT: %.loc24_31.3: init %IntConstructor to %.loc24_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc24_31.4: init %IntConstructor = converted %u.ref, %.loc24_31.3
// CHECK:STDOUT: %.loc24_31.5: ref %IntConstructor = temporary %.loc24_31.1, %.loc24_31.4
// CHECK:STDOUT: %.loc24_31.6: %IntConstructor = acquire_value %.loc24_31.5
// CHECK:STDOUT: %.loc24_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %.loc21_31.3: init %IntConstructor to %.loc21_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc21_31.4: init %IntConstructor = converted %u.ref, %.loc21_31.3
// CHECK:STDOUT: %.loc21_31.5: ref %IntConstructor = temporary %.loc21_31.1, %.loc21_31.4
// CHECK:STDOUT: %.loc21_31.6: %IntConstructor = acquire_value %.loc21_31.5
// CHECK:STDOUT: %.loc21_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %IntConstructor.ref: type = name_ref IntConstructor, imports.%IntConstructor.decl [concrete = constants.%IntConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc24_31.6
// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc21_31.6
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.c4e = value_binding_pattern _ [concrete = constants.%_.patt.151]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc24_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc21_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc21_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc21_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc21_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc21_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc21_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_31.5)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc21_31.5)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1384,38 +1332,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromTuple() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc16_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc16_27.2: %Aggregate = converted %.loc16_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Aggregate.ref.loc16 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc16: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_29.1: %tuple.type.985 = tuple_literal (%int_1.loc32) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc32_29.2: %Aggregate = converted %.loc32_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_29.1: %tuple.type.985 = tuple_literal (%int_1.loc26) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc26_29.2: %Aggregate = converted %.loc26_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %Aggregate.ref.loc26 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc26: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc46, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc46_31.2: %Aggregate = converted %.loc46_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc36_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc36, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc36_31.2: %Aggregate = converted %.loc36_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %Aggregate.ref.loc36 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc36: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
@@ -1447,38 +1395,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc16_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc16_27.2: %Aggregate = converted %.loc16_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %Aggregate.ref.loc16 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc16: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_33.1: %struct_type.x = struct_literal (%int_1.loc32) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc32_33.2: %Aggregate = converted %.loc32_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_33.1: %struct_type.x = struct_literal (%int_1.loc26) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc26_33.2: %Aggregate = converted %.loc26_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %Aggregate.ref.loc26 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc26: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_41.1: %struct_type.x.y = struct_literal (%int_1.loc46, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc46_41.2: %Aggregate = converted %.loc46_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: %.loc36_41.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc36_41.2: %Aggregate = converted %.loc36_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %Aggregate.ref.loc36 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc36: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
@@ -1686,38 +1634,38 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc19_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_30.2: %NonAggregate = converted %.loc19_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %NonAggregate.ref.loc19 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc19: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: %.loc16_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc16_30.2: %NonAggregate = converted %.loc16_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc16_13: type = splice_block %NonAggregate.ref.loc16 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc16: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc19: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc16: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc16: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc33_36.1: %struct_type.x = struct_literal (%int_1.loc33) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc33_36.2: %NonAggregate = converted %.loc33_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc33_13: type = splice_block %NonAggregate.ref.loc33 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc33: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: %int_1.loc26: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc26_36.1: %struct_type.x = struct_literal (%int_1.loc26) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc26_36.2: %NonAggregate = converted %.loc26_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc26_13: type = splice_block %NonAggregate.ref.loc26 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc26: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc33: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc26: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc33: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc26: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc48_44.1: %struct_type.x.y = struct_literal (%int_1.loc48, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc48_44.2: %NonAggregate = converted %.loc48_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc48_13: type = splice_block %NonAggregate.ref.loc48 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc48: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc48: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: %.loc36_44.1: %struct_type.x.y = struct_literal (%int_1.loc36, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc36_44.2: %NonAggregate = converted %.loc36_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc36_13: type = splice_block %NonAggregate.ref.loc36 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc36: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc48: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: %_.loc36: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc48: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: %_.patt.loc36: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
+4 -7
View File
@@ -1014,7 +1014,7 @@ Struct s;
''';
fn F() {
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+19]]:3
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `lvalue path contains an array type`
@@ -1022,15 +1022,12 @@ fn F() {
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `m` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `array(i32, 3)`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(array(i32, 3))`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `array(i32, 3)`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.m = 2;
@@ -66,7 +66,7 @@ inline Cpp '''
Carbon::C* p;
// CHECK:STDERR: ╭─┤ fail_current_package_not_in_carbon.carbon:[[@LINE+7]]:25
// CHECK:STDERR: -> │ namespace Bad = Carbon::SelfPkg;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: expected namespace name
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -84,7 +84,7 @@ inline Cpp '''
Carbon::C* p;
// CHECK:STDERR: ╭─┤ fail_main_package_not_in_carbon.carbon:[[@LINE+7]]:25
// CHECK:STDERR: -> │ namespace Bad = Carbon::Main;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: expected namespace name
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -134,7 +134,7 @@ void TestTypoInCarbon() {
// CHECK:STDERR: · ╰──┤ 'ExportedType' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::ExportedTyp* p_typo = p1;
// CHECK:STDERR: · ───────╴┎┬─────────
// CHECK:STDERR: · ━━━━━━━╸┎┬─────────
// CHECK:STDERR: · ┗━━━┫ error: no type named 'ExportedTyp' in namespace 'Carbon'; did
// CHECK:STDERR: · │ ┃ you mean 'ExportedType'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
@@ -70,7 +70,7 @@ void G() {
// This is not found because it looks for the identifier `Cpp`, not the keyword `Cpp`.
// CHECK:STDERR: ╭─┤ fail_carbon_cpp.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::Cpp::F();
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
@@ -99,7 +99,7 @@ void GRaw() {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_carbon_raw_cpp.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::Cpp::FRaw();
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
+50 -61
View File
@@ -93,18 +93,16 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct NeqBoolish {
auto operator==(NeqBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator!=(NeqBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
@@ -117,20 +115,17 @@ struct NeqBoolish {
};
struct EqBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+19]]:8
// CHECK:STDERR: -> │ auto operator==(EqBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
@@ -148,20 +143,17 @@ struct BothBoolish {
False,
True,
};
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+19]]:8
// CHECK:STDERR: -> │ auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `bool`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
@@ -171,20 +163,17 @@ struct BothBoolish {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+19]]:8
// CHECK:STDERR: -> │ auto operator!=(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `bool`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
@@ -246,9 +235,9 @@ fn Test(default_eq_only: Cpp.DefaultEqOnly,
only_eq_declared: Cpp.OnlyEqDeclared) {
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_eq_only, default_eq_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -263,9 +252,9 @@ fn Test(default_eq_only: Cpp.DefaultEqOnly,
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_eq_declared, only_eq_declared);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -329,9 +318,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
a2: Cpp.A2, b2: Cpp.B2) {
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_neq, only_neq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -362,9 +351,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -377,9 +366,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(eq_returns_void, eq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -392,9 +381,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(neq_returns_void, neq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -414,9 +403,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(deleted_neq, deleted_neq);
// CHECK:STDERR: · ┳
@@ -429,9 +418,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(non_const_eq, non_const_eq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -444,9 +433,9 @@ fn Test(only_neq: Cpp.OnlyNeq,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(a2, b2);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
@@ -236,15 +236,12 @@ fn F() {
var c: Cpp.BinaryC = {};
// Simple assignment.
// CHECK:STDERR: ╭─┤ fail_todo_import_assignment.carbon:[[@LINE+11]]:3
// CHECK:STDERR: ╭─┤ fail_todo_import_assignment.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ c = 42;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `Cpp.BinaryC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.BinaryC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Cpp.BinaryC`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c = 42;
@@ -734,7 +731,7 @@ fn F() {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:53
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ╻╺━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot take the
// CHECK:STDERR: · ┃ address of
// CHECK:STDERR: · ┃ non-reference
@@ -1012,7 +1009,7 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: ╭─┤ fail_import_incomplete_unary.carbon:[[@LINE+15]]:34
// CHECK:STDERR: ╭─┤ fail_import_incomplete_unary.carbon:[[@LINE+14]]:34
// CHECK:STDERR: -> │ let unused result_unary: i32 = -*Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
@@ -1020,7 +1017,6 @@ fn F() {
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_unary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
@@ -1038,7 +1034,7 @@ import Cpp library "incomplete.h";
fn F() {
var complete: Cpp.Complete = Cpp.Complete.Complete();
// CHECK:STDERR: ╭─┤ fail_import_incomplete_binary.carbon:[[@LINE+15]]:35
// CHECK:STDERR: ╭─┤ fail_import_incomplete_binary.carbon:[[@LINE+14]]:35
// CHECK:STDERR: -> │ let unused result_binary: i32 = complete + *Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
@@ -1046,7 +1042,6 @@ fn F() {
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_binary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
@@ -1077,8 +1072,8 @@ fn F() {
var complete: Cpp.CompleteCpp = Cpp.CompleteCpp.CompleteCpp();
// CHECK:STDERR: ╭─┤ fail_incomplete_operand_carbon_type.carbon:[[@LINE+12]]:28
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ────────┬────────
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: · ─────┬────
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ let unused result: i32 = *CreateIncomplete() + complete;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -118,18 +118,16 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct LessReturnsBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator<(LessReturnsBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
@@ -146,20 +144,17 @@ struct LessReturnsBoolish {
struct LessEqualReturnsBoolish {
auto operator<(LessEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+19]]:8
// CHECK:STDERR: -> │ auto operator<=(LessEqualReturnsBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
@@ -178,20 +173,17 @@ struct GreaterEqualReturnsBoolish {
auto operator<(GreaterEqualReturnsBoolish) const -> bool;
auto operator<=(GreaterEqualReturnsBoolish) const -> bool;
auto operator>(GreaterEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+19]]:8
// CHECK:STDERR: -> │ auto operator>=(GreaterEqualReturnsBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `bool`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
@@ -215,18 +207,16 @@ struct GreaterReturnsBoolish {
};
struct AllReturnBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
@@ -236,18 +226,16 @@ struct AllReturnBoolish {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
@@ -257,18 +245,16 @@ struct AllReturnBoolish {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Greater(self, other: Other) -> bool;
@@ -278,18 +264,16 @@ struct AllReturnBoolish {
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+18]]:8
// CHECK:STDERR: -> │ auto operator>=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
@@ -387,9 +371,9 @@ fn Test(missing_less: Cpp.MissingLess,
less_non_const: Cpp.LessNonConst) {
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less, missing_less);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -402,9 +386,9 @@ fn Test(missing_less: Cpp.MissingLess,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less_equal, missing_less_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -417,9 +401,9 @@ fn Test(missing_less: Cpp.MissingLess,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater, missing_greater);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -432,9 +416,9 @@ fn Test(missing_less: Cpp.MissingLess,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater_equal, missing_greater_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -447,9 +431,9 @@ fn Test(missing_less: Cpp.MissingLess,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -462,9 +446,9 @@ fn Test(missing_less: Cpp.MissingLess,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(less_returns_void, less_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -154,9 +154,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
cross_type_rhs: Cpp.CrossTypeRhs) {
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -169,9 +169,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -183,9 +183,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -197,9 +197,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -211,9 +211,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -225,9 +225,9 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+20]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_rhs, cross_type_lhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -257,9 +257,9 @@ fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) {
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ───┬──
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -63,25 +63,30 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+6]]:1
// CHECK:STDERR: -> │ class C;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class C;
fn F() -> array(C, 5)*;
inline Cpp '''
void G() {
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+23]]:35
// CHECK:STDERR: │ class C;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::C *p = &(*Carbon::F())[0];
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: use of incomplete Carbon type `C`
// CHECK:STDERR: · ┃ [IncompleteTypeInCppUse]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+12]]:33
// CHECK:STDERR: │ class C;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'Carbon::Main::C' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::C *p = &(*Carbon::F())[0];
// CHECK:STDERR: · ─────────────╴╻
// CHECK:STDERR: · ━━━━━━━━━━━━━╸╻
// CHECK:STDERR: · ┗━━┫ error: subscript of pointer to incomplete
// CHECK:STDERR: · ┃ type 'Carbon::Main::C'
// CHECK:STDERR: · ┃ [CppInteropParseError]
@@ -85,16 +85,13 @@ import Cpp;
fn F() {
let carbon_i64: i64 = 1;
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_i64_to_long.carbon:[[@LINE+12]]:35
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_i64_to_long.carbon:[[@LINE+9]]:35
// CHECK:STDERR: -> │ let unused cpp_long: Cpp.long = carbon_i64;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `i64` to
// CHECK:STDERR: · │ ┃ `Cpp.long`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i64` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.long)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ expression of type `i64` to
// CHECK:STDERR: · ┃ `Cpp.long`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused cpp_long: Cpp.long = carbon_i64;
@@ -636,16 +633,13 @@ fn F() {
// For portability reasons, this is not allowed even though `u64`
// happens to fit in `unsigned long` on this target.
// CHECK:STDERR: ╭─┤ fail_pass_u64_to_ulong.carbon:[[@LINE+12]]:53
// CHECK:STDERR: ╭─┤ fail_pass_u64_to_ulong.carbon:[[@LINE+9]]:53
// CHECK:STDERR: -> │ let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64;
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `u64` to
// CHECK:STDERR: · ┃ `Cpp.unsigned_long`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭────────────────────────────────────────────────────────╯
// CHECK:STDERR: · │ type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64;
@@ -79,15 +79,12 @@ import Cpp;
fn F() {
let cpp_long: Cpp.long = 1;
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_to_i32.carbon:[[@LINE+11]]:32
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_to_i32.carbon:[[@LINE+8]]:32
// CHECK:STDERR: -> │ let unused carbon_i32: i32 = cpp_long;
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `long` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ of type `long` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused carbon_i32: i32 = cpp_long;
@@ -724,15 +721,12 @@ fn F() {
// For portability reasons, this is not allowed even though `unsigned long`
// happens to fit in `u32` on this target.
// CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+17]]:25
// CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+14]]:25
// CHECK:STDERR: -> │ let carbon_u32: u32 = cpp_unsigned_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `unsigned_long` to `u32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(u32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `unsigned_long` to `u32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+6]]:7
@@ -78,15 +78,12 @@ import Cpp;
fn F() {
let cpp_long_long: Cpp.long_long = 1;
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+11]]:32
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+8]]:32
// CHECK:STDERR: -> │ let unused carbon_i64: i64 = cpp_long_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `long_long` to `i64`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.long_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(i64)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ of type `long_long` to `i64`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused carbon_i64: i64 = cpp_long_long;
@@ -652,15 +649,12 @@ fn F() {
// For portability reasons, this is not allowed even though `unsigned long
// long` happens to fit in `u64` on this target.
// CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+17]]:25
// CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+14]]:25
// CHECK:STDERR: -> │ let carbon_u64: u64 = cpp_unsigned_long_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `unsigned_long_long` to `u64`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(u64)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `unsigned_long_long` to `u64`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+6]]:7
@@ -76,15 +76,12 @@ struct S {};
fn F(input: Cpp.void*) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ let unused p: Cpp.S* = input as Cpp.S*;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*`
// CHECK:STDERR: · │ ┃ to `Cpp.S*` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.S*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ to `Cpp.S*` with `as`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused p: Cpp.S* = input as Cpp.S*;
@@ -101,15 +98,12 @@ class C {}
fn F(input: Cpp.void*) {
//@dump-sem-ir-begin
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+11]]:22
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+8]]:22
// CHECK:STDERR: -> │ let unused p: C* = input as C*;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*` to
// CHECK:STDERR: · │ ┃ `C*` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface
// CHECK:STDERR: · │ `Core.As(C*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `C*` with `as`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused p: C* = input as C*;
@@ -414,14 +408,14 @@ fn F(input: Cpp.void*) {
// CHECK:STDOUT: fn @F(%input.param: %ptr.00a) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input
// CHECK:STDOUT: %Cpp.ref.loc21_35: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc21_38: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc21_40: type = ptr_type %S.ref.loc21_38 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %.loc21_32: %ptr.037 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_22: type = splice_block %ptr.loc21_22 [concrete = constants.%ptr.037] {
// CHECK:STDOUT: %Cpp.ref.loc21_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc21_20: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc21_22: type = ptr_type %S.ref.loc21_20 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %Cpp.ref.loc18_35: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc18_38: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc18_40: type = ptr_type %S.ref.loc18_38 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %.loc18_32: %ptr.037 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc18_22: type = splice_block %ptr.loc18_22 [concrete = constants.%ptr.037] {
// CHECK:STDOUT: %Cpp.ref.loc18_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc18_20: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc18_22: type = ptr_type %S.ref.loc18_20 [concrete = constants.%ptr.037]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.037 = wrapper_binding p, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
@@ -445,12 +439,12 @@ fn F(input: Cpp.void*) {
// CHECK:STDOUT: fn @F(%input.param: %ptr.00a) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input
// CHECK:STDOUT: %C.ref.loc21_31: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc21_32: type = ptr_type %C.ref.loc21_31 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %.loc21_28: %ptr.6b6 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_18: type = splice_block %ptr.loc21_18 [concrete = constants.%ptr.6b6] {
// CHECK:STDOUT: %C.ref.loc21_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc21_18: type = ptr_type %C.ref.loc21_17 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc18_32: type = ptr_type %C.ref.loc18_31 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %.loc18_28: %ptr.6b6 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc18_18: type = splice_block %ptr.loc18_18 [concrete = constants.%ptr.6b6] {
// CHECK:STDOUT: %C.ref.loc18_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc18_18: type = ptr_type %C.ref.loc18_17 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.6b6 = wrapper_binding p, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
+75 -75
View File
@@ -253,9 +253,9 @@ public:
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) {
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
@@ -275,9 +275,9 @@ public:
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = f64](r: R) {
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
@@ -397,9 +397,9 @@ public:
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
@@ -419,9 +419,9 @@ public:
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
@@ -448,9 +448,9 @@ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.ValueType
fn TestIterateDriver(var m: Cpp.DiffMutableADL.MutableRange) {
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+28]]:3
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ TestIterate(m);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
@@ -461,9 +461,9 @@ fn TestIterateDriver(var m: Cpp.DiffMutableADL.MutableRange) {
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+15]]:3
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.DiffMutableADL.Val...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ TestIterate(m);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
@@ -532,9 +532,9 @@ class MutableAndConstRange {
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueT...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
@@ -554,9 +554,9 @@ class MutableAndConstRange {
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn TestIterate[R: Core.Iterate where .ElementType = Cpp.OverloadADL.ValueT...
// CHECK:STDERR: · ─────────────────────────┬──────────────────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
@@ -679,9 +679,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
{
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(no_begin_end);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
@@ -694,9 +694,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(no_begin_method);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
@@ -709,9 +709,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(no_end_method);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
@@ -724,9 +724,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(no_begin_adl);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
@@ -739,9 +739,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(no_end_adl);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
@@ -754,9 +754,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_method_end_adl);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -769,9 +769,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_adl_end_method);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -784,9 +784,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_field_end_method);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -799,9 +799,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_method_end_field);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -819,9 +819,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_method_deleted);
// CHECK:STDERR: · ┳
@@ -831,9 +831,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_method_deleted);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -850,9 +850,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: · ╰──┤ 'end' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(end_method_deleted);
// CHECK:STDERR: · ┳
@@ -862,9 +862,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(end_method_deleted);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
@@ -882,9 +882,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_function_deleted);
// CHECK:STDERR: · ┳
@@ -894,9 +894,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(begin_function_deleted);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -914,9 +914,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(end_function_deleted);
// CHECK:STDERR: · ┳
@@ -926,9 +926,9 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd,
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn Test[R: Core.Iterate](unused r: R) {}
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: · ──┬─
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Test(end_function_deleted);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -41,15 +41,12 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: ╭─┤ fail_int_param_mismatch.carbon:[[@LINE+11]]:1
// CHECK:STDERR: ╭─┤ fail_int_param_mismatch.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ var s: Cpp.Simple(456) = Cpp.MakeSimple123();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Simple` to
// CHECK:STDERR: · │ ┃ `Cpp.Simple`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Simple` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Simple)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ `Cpp.Simple`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var s: Cpp.Simple(456) = Cpp.MakeSimple123();
@@ -143,15 +140,12 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, Cpp.A) = {};
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `type` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `type` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `type` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoNonType(1, Cpp.A) = {};
@@ -164,15 +158,12 @@ import Cpp library "templates.h";
var n: i32;
// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+11]]:26
// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, &n) = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `i32*` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ type `i32*` to `i32`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoNonType(1, &n) = {};
@@ -43,15 +43,12 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+11]]:28
// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+8]]:28
// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, true);
// CHECK:STDERR: · ┳━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value
// CHECK:STDERR: · │ ┃ of type `bool` to `type`
// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: · ╰────┤ type `bool` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(type)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ┃ of type `bool` to `type`
// CHECK:STDERR: · ┃ [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTypes(Cpp.A, true);