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

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

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

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

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

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

No files matched your search

@@ -57,7 +57,12 @@ import Cpp library "abstract.h";
class C {
extend base: Cpp.A;
// CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+2]]:3-40: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╭─┤ fail_impl_mismatch_member.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ override fn invalid(unused ref self) {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn invalid(unused ref self) {}
}
@@ -76,7 +81,13 @@ library "[[@TEST_NAME]]";
import Cpp library "abstract_final.h";
class C {
// CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+2]]:16-32: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_abstract_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.AbstractFinal;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `AbstractFinal`; base type
// CHECK:STDERR: · ┃ must be an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.AbstractFinal;
}
File diff suppressed because it is too large. Load diff
+200 -40
View File
@@ -156,71 +156,147 @@ library "[[@TEST_NAME]]";
import Cpp library "multiple_inheritance.h";
fn ConvertA(p: Cpp.C*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertB(p: Cpp.C*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -268,8 +344,16 @@ library "[[@TEST_NAME]]";
import Cpp library "virtual_inheritance.h";
fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* {
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `VirtB*` to
// CHECK:STDERR: · │ ┃ `Cpp.VirtA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.VirtB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.VirtA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -299,57 +383,121 @@ library "[[@TEST_NAME]]";
import Cpp library "diamond.h";
fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondB*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondC*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondC*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn AccessBA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondB).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondB).b;
}
fn AccessCA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondC).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondC).b;
}
fn AccessDB(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.b;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.b;
}
fn AccessDC(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.c;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.c;
}
@@ -365,7 +513,13 @@ library "[[@TEST_NAME]]";
import Cpp library "final.h";
class B {
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-25: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.FinalA;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `FinalA`; base type must be
// CHECK:STDERR: · ┃ an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.FinalA;
}
@@ -381,7 +535,13 @@ library "[[@TEST_NAME]]";
import Cpp library "union.h";
class V {
// CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+2]]:16-20: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_union.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.U;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `U`; base type must be an
// CHECK:STDERR: · ┃ `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.U;
}
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ class DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}
@@ -231,11 +241,28 @@ class Class1;
class Generic(x: Core.Copy) {
}
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:19-37: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-7]]:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-5]]:15-26: note: initializing generic parameter `x` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+23]]:19
// CHECK:STDERR: │ class Class1;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ class Generic(x: Core.Copy) {
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `x` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: argument to C++ call has incomplete type
// CHECK:STDERR: · ┃ `Cpp.Class1`
// CHECK:STDERR: · ┃ [IncompleteTypeInCopyWitness]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+2]]:15-37: warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:15
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn GenericUse(p2: Generic(Cpp.Class1)) {
}
@@ -80,8 +80,18 @@ fn G(generic T: Core.Default & Core.Destroy) {
}
fn CallG() {
// CHECK:STDERR: fail_no_default.carbon:[[@LINE+3]]:3-18: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_no_default.carbon:[[@LINE-6]]:14-43: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_no_default.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn G(generic T: Core.Default & Core.Destroy) {
// CHECK:STDERR: · ──────────────┬───────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ G(Cpp.NoDefault);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `NoDefault` into type implementing
// CHECK:STDERR: · ┃ `Core.Default & Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
G(Cpp.NoDefault);
}
@@ -208,13 +218,33 @@ library "[[@TEST_NAME]]";
import Cpp library "deleted.h";
fn F() {
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+3]]:32-52: error: call to deleted function 'DeletedC' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:4:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+12]]:32
// CHECK:STDERR: -> │ let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedC'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedC() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+4]]:32-52: error: call to deleted function 'DeletedD' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:9:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ./deleted.h:10:3: note: candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+15]]:32
// CHECK:STDERR: -> │ let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedD'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedD(int) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ DeletedD(short);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
}
@@ -283,9 +313,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:4-30: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:4
// CHECK:STDERR: -> │ Cpp.IncompleteC.IncompleteC();
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteC`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class IncompleteC;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.IncompleteC.IncompleteC();
}
@@ -95,11 +95,39 @@ fn GetF(a: Cpp.A) -> i32 { return a.f_4; }
struct BitfieldStruct {
int a;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int b : 2;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.b;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int b : 2;
};
union BitfieldUnion {
int c;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int d : 3;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.d;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int d : 3;
};
@@ -125,24 +153,16 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:4:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "with_bitfields.h";
fn F(s: Cpp.BitfieldStruct) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10-12: note: in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:9:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
return s.b;
//@dump-sem-ir-end
}
fn G(s: Cpp.BitfieldUnion) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10-12: note: in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR:
return s.d;
//@dump-sem-ir-end
}
@@ -151,6 +171,22 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
struct UnsupportedMembers {
// Volatile is not supported.
// CHECK:STDERR: ╷ ╭── included from: fail_use_unsupported_members.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./unsupported_members.h:[[@LINE+15]]:16
// CHECK:STDERR: -> │ volatile int is_volatile;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_use_unsupported_members.carbon
// CHECK:STDERR: │ let unused a: i32 = m->is_volatile;
// CHECK:STDERR: · ───────┬──────
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `is_volatile`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
volatile int is_volatile;
// But this should be fine.
int integer;
@@ -175,13 +211,9 @@ fn Test(m: Cpp.UnsupportedMembers*) {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_use_unsupported_members.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./unsupported_members.h:4:16: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "unsupported_members.h";
fn Test(m: Cpp.UnsupportedMembers*) {
// CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+2]]:23-36: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup]
// CHECK:STDERR:
let unused a: i32 = m->is_volatile;
}
@@ -16,7 +16,11 @@ library "[[@TEST_NAME]]";
import Cpp inline '''
struct Base {
// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:3: error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ no_such_type invalid;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
no_such_type invalid;
};
@@ -59,24 +59,67 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Value(v: Cpp.HasQualifiers) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-9: error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:3:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ v.plain();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void plain();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.plain();
// TODO: This should remain invalid once we support `volatile`.
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-17: error: no matching function for call to 'volatile_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:5:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.volatile_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'volatile_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void volatile_this() volatile;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.volatile_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-12: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_this();
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-16: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_ref_this();
}
@@ -89,7 +132,13 @@ import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// TODO: This should eventually be accepted if we support `volatile`.
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+2]]:3-20: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ p->volatile_this();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: parameter type: volatile struct HasQualifiers &`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->volatile_this();
}
@@ -101,15 +150,36 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:10:20-21: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ p->ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->ref_ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-23: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:11:26-27: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ p->const_ref_ref_this();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'const_ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void const_ref_ref_this() const&&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->const_ref_ref_this();
}
@@ -123,9 +193,19 @@ import Cpp library "object_param_qualifiers.h";
fn Make() -> Cpp.HasQualifiers;
fn F() {
// CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:7:16-17: note: expects an lvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Make().ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an lvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Make().ref_this();
}
@@ -200,7 +280,12 @@ struct ExplicitObjectParamUnsupported {
''';
fn Call(e: Cpp.ExplicitObjectParamUnsupported) {
// CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
}
@@ -29,8 +29,14 @@ library "[[@TEST_NAME]]";
import Cpp library "non_aggregate.h";
fn Make() {
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+3]]:3-14: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+2]]:3-14: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ var _: Cpp.X = {};
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `Cpp.X`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: Cpp.X = {};
}
@@ -41,10 +41,29 @@ import Cpp library "overload.h";
class Overload0Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has more parameters (2 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (2 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self);
}
@@ -52,10 +71,29 @@ class Overload0Params {
class Overload3Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-52: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has fewer parameters (2 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (2 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
}
@@ -70,14 +108,37 @@ import Cpp library "overload.h";
class OverloadX {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:7:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X);
}
@@ -85,14 +146,37 @@ class OverloadX {
class OverloadY {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:6:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, y: Cpp.Y);
}
@@ -65,10 +65,25 @@ import Cpp library "instantiation_error.h";
//@dump-sem-ir-begin
var x: Cpp.XY.r#type = 0;
// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+5]]:8-22: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_use_instantiation_error.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./instantiation_error.h:3:25: note: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X<int>' requested here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_use_instantiation_error.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ var y: Cpp.Xint.r#type = 0;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.X`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_instantiation_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./instantiation_error.h
// CHECK:STDERR: │ template<typename T> struct X {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'X<int>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │ using type = typename T::member;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ type 'int' cannot be used prior to '::' because it
// CHECK:STDERR: · │ has no members
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var y: Cpp.Xint.r#type = 0;
//@dump-sem-ir-end
@@ -289,11 +304,11 @@ fn G() {
// CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete]
// CHECK:STDOUT: %.loc14: type = splice_block %type.ref.loc14 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc29: type = splice_block %type.ref.loc29 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Xint.ref: type = name_ref Xint, imports.%X.decl.b67 [concrete = constants.%X.c92]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %type.ref.loc14: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: %type.ref.loc29: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var]
// CHECK:STDOUT: name_binding_decl {
@@ -312,14 +327,14 @@ fn G() {
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_1.2(%int_0.loc7) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%x.var, %.loc7
// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc14: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc14_1.1: <bound method> = bound_method %int_0.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc14_1.2: <bound method> = bound_method %int_0.loc14, %specific_fn.loc14 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_1.2(%int_0.loc14) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc14: init %i32 = converted %int_0.loc14, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc14
// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc29_1.1: <bound method> = bound_method %int_0.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc29: <specific function> = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc29_1.2: <bound method> = bound_method %int_0.loc29, %specific_fn.loc29 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_1.2(%int_0.loc29) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc29: init %i32 = converted %int_0.loc29, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc29
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ union DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}