mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 18:20:36 +00:00
Render diagnostics through the terminal library (#7683)
Diagnostic rendering was part of the data model: `Loc::FormatLocation` and `Loc::FormatSnippet` wrote plain text to a stream, so no capability, color, or terminal width could reach them. A diagnostic is now one message with labels, contexts, and location information attached, and `Diagnostics::Renderer` draws it into a `Terminal::Buffer`. The design is in `toolchain/docs/diagnostics_rendering.md` (#7668), authoring in `toolchain/docs/diagnostics.md`. Before: ``` example.carbon:6:3: error: 1 argument passed to function expecting 0 arguments Run0(1); ^~~~~~~ example.carbon:3:1: note: calling function declared here fn Run0() {} ^~~~~~~~~~~ ``` After: ``` error: 1 argument passed to function expecting 0 arguments ╭─┤ example.carbon:6:3 ┆ 3 │ fn Run0() {} · ─────┬───── · ╰──┤ calling function declared here ┆ -> 6 │ Run0(1); · ─────── ╰──────────── ``` `--no-diagnostic-snippets` gives a compact form, `example.carbon:6:3-9`. File tests use it; the rendering tests under `toolchain/diagnostics/testdata` ask for snippets. C++ interop diagnostics are data now rather than text Clang drew: `SemIR::ClangSourceLocId` names a `clang::SourceRange`, and a Clang location is marked as the point it names. `StreamConsumer` moves to a `:renderer` target that `:emitter` does not depend on, keeping `common/terminal` out of `consumer.h`. Capabilities come from the file behind the error stream, so tests get plain ASCII. `renderer_fuzzer` draws diagnostics built from fuzzer bytes with every capability combination, since a shape the renderer doesn't expect must never be why the compiler dies while reporting a problem. TODOs mark the follow-ups: line weights and crossing lines, wrapping that keeps a quoted type whole, and ordering diagnostics that share a byte offset. Also: `IncorrectExtension`'s hint moves into its message, since its note had no location of its own, and `strip_noise` in `check_diagnostics.py` blanks multi-line `#define`s instead of deleting them. Assisted-by: Claude Code
This commit is contained in:
1 parent
e1c8c1f855
commit
2c9739799b
1205 files changed
+20291
-24988
No files matched your search
+12
-36
@@ -62,12 +62,8 @@ import Cpp;
|
||||
class FinalClass {}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+7]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | struct A : Carbon::FinalClass {};
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-6]]:18: note: 'FinalClass' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | class FinalClass {}
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-4]]:18: note: 'FinalClass' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
struct A : Carbon::FinalClass {};
|
||||
''';
|
||||
@@ -84,21 +80,15 @@ struct VirtualDestructor {
|
||||
};
|
||||
''';
|
||||
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithVdtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithVdtor {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+2]]:1-34: error: cannot access member of interface `Core.Destroy` in type `AbstractWithVdtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractWithVdtor {
|
||||
extend base: Cpp.VirtualDestructor;
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+7]]:27: error: variable type 'Carbon::AbstractWithVdtor' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 28 | Carbon::AbstractWithVdtor x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-8]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 16 | abstract class AbstractWithVdtor {
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:27: error: variable type 'Carbon::AbstractWithVdtor' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-6]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
Carbon::AbstractWithVdtor x;
|
||||
''';
|
||||
@@ -110,13 +100,9 @@ import Cpp;
|
||||
|
||||
// TODO: Find a way to export this to C++ as an abstract class, despite not
|
||||
// having a vptr.
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+8]]:1: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: abstract class AbstractNonvirtualDtor {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1-39: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractNonvirtualDtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractNonvirtualDtor {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+2]]:1-39: error: cannot access member of interface `Core.Destroy` in type `AbstractNonvirtualDtor` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractNonvirtualDtor {}
|
||||
|
||||
@@ -132,9 +118,7 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethodNoVptr` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithMethodNoVptr {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+2]]:1-41: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethodNoVptr` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractWithMethodNoVptr {
|
||||
abstract fn F(self);
|
||||
@@ -153,21 +137,15 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethod` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractWithMethod {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+2]]:1-35: error: cannot access member of interface `Core.Destroy` in type `AbstractWithMethod` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractWithMethod {
|
||||
abstract fn F(self);
|
||||
}
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+7]]:28: error: variable type 'Carbon::AbstractWithMethod' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | Carbon::AbstractWithMethod x_abstract;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-7]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 13 | abstract fn F(self);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:28: error: variable type 'Carbon::AbstractWithMethod' is an abstract class [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-5]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
Carbon::AbstractWithMethod x_abstract;
|
||||
''';
|
||||
@@ -180,9 +158,7 @@ import Cpp;
|
||||
// TODO: We should support generating a base subobject destructor for an
|
||||
// abstract class, even though we refuse to generate a complete object
|
||||
// destructor.
|
||||
// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+4]]:1: error: cannot access member of interface `Core.Destroy` in type `AbstractToOverride` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR: abstract class AbstractToOverride {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+2]]:1-35: error: cannot access member of interface `Core.Destroy` in type `AbstractToOverride` that does not implement that interface [MissingImplInMemberAccess]
|
||||
// CHECK:STDERR:
|
||||
abstract class AbstractToOverride {
|
||||
abstract fn F(ref self);
|
||||
|
||||
@@ -59,19 +59,13 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+4]]:1: error: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR: class IncompleteConcreteA;
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+2]]:1-26: error: class was forward declared here [ClassForwardDeclaredHere]
|
||||
// CHECK:STDERR:
|
||||
class IncompleteConcreteA;
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+7]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-6]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | class IncompleteConcreteA;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+3]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-4]]:26: note: forward declaration of 'Carbon::IncompleteConcreteA' [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
Carbon::IncompleteConcreteA incomplete_concrete_a;
|
||||
''';
|
||||
@@ -81,9 +75,7 @@ library "[[@TEST_NAME]]";
|
||||
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
|
||||
// CHECK:STDERR: class B(N: i32) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
class B(N: i32) {
|
||||
var a: array(i8, N);
|
||||
@@ -94,13 +86,9 @@ class B(N: i32) {
|
||||
alias T = B(-1);
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+8]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR: Carbon::T t;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 26 | Carbon::T t;
|
||||
// CHECK:STDERR: | ~~~~~~~~^
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
Carbon::T t;
|
||||
''';
|
||||
+10
-30
@@ -75,14 +75,10 @@ class EmptyClass {}
|
||||
inline Cpp '''
|
||||
void AccessNonexistentField() {
|
||||
Carbon::EmptyClass a;
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 13 | a.x = 12;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
a.x = 12;
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 18 | a.y = 34;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::EmptyClass' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
a.y = 34;
|
||||
}
|
||||
@@ -93,14 +89,10 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class UnsupportedFieldType {
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: var x: ();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
var x: ();
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:7: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: var y: ();
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
var y: ();
|
||||
}
|
||||
@@ -108,14 +100,10 @@ class UnsupportedFieldType {
|
||||
inline Cpp '''
|
||||
void AccessUnsupportedField() {
|
||||
Carbon::UnsupportedFieldType a;
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR: 24 | a.x;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
a.x;
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+4]]:5: error: no member named 'y' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR: 29 | a.y;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::UnsupportedFieldType' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
a.y;
|
||||
}
|
||||
@@ -132,9 +120,7 @@ class AdaptedClass {
|
||||
inline Cpp '''
|
||||
void AccessAdaptedField() {
|
||||
Carbon::AdaptedClass a;
|
||||
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+4]]:5: error: no member named 'x' in 'Carbon::AdaptedClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 15 | a.x = 12;
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::AdaptedClass' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
a.x = 12;
|
||||
}
|
||||
@@ -146,9 +132,7 @@ import Cpp;
|
||||
|
||||
// This should not cause a crash.
|
||||
class InvalidBaseClass {
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+4]]:16: error: name `Whoops` not found [NameNotFound]
|
||||
// CHECK:STDERR: extend base: Whoops;
|
||||
// CHECK:STDERR: ^~~~~~
|
||||
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:16-21: error: name `Whoops` not found [NameNotFound]
|
||||
// CHECK:STDERR:
|
||||
extend base: Whoops;
|
||||
}
|
||||
@@ -172,12 +156,8 @@ class ClassWithPrivateField {
|
||||
inline Cpp '''
|
||||
int AccessPrivateField() {
|
||||
auto c = Carbon::ClassWithPrivateField::Make();
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+7]]:12: error: 'x' is a private member of 'Carbon::ClassWithPrivateField' [CppInteropParseError]
|
||||
// CHECK:STDERR: 22 | return c.x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE-9]]:16: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 9 | private var x: i32;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+3]]:12: error: 'x' is a private member of 'Carbon::ClassWithPrivateField' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_private_field.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
return c.x;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@ void FSpecific() {
|
||||
library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:1: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR: class UnsupportedClass(T: type) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:1-33: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
class UnsupportedClass(T: type) {
|
||||
var t: T;
|
||||
@@ -56,13 +54,9 @@ alias AliasEmptyTuple = UnsupportedClass(());
|
||||
|
||||
inline Cpp '''
|
||||
void FUnsupported() {
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+8]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR: Carbon::AliasEmptyTuple a;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 23 | Carbon::AliasEmptyTuple a;
|
||||
// CHECK:STDERR: | ~~~~~~~~^
|
||||
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
Carbon::AliasEmptyTuple a;
|
||||
a.t = 123;
|
||||
@@ -74,9 +68,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp;
|
||||
|
||||
class ClassWithMethod(T: type) {
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:3: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
|
||||
// CHECK:STDERR: fn M(unused ref self) {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:3-25: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
fn M(unused ref self) {}
|
||||
}
|
||||
@@ -84,9 +76,7 @@ class ClassWithMethod(T: type) {
|
||||
inline Cpp '''
|
||||
void FMethodCall() {
|
||||
Carbon::ClassWithMethod<int> c;
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+4]]:5: error: no member named 'M' in 'Carbon::ClassWithMethod<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR: 19 | c.M();
|
||||
// CHECK:STDERR: | ~ ^
|
||||
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:5: error: no member named 'M' in 'Carbon::ClassWithMethod<int>' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
c.M();
|
||||
}
|
||||
|
||||
@@ -92,12 +92,8 @@ class RefMethodRValueClass {
|
||||
|
||||
inline Cpp '''
|
||||
void RefMethodRValue() {
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | Carbon::RefMethodRValueClass().M();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | fn M(ref self);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
Carbon::RefMethodRValueClass().M();
|
||||
}
|
||||
@@ -113,12 +109,8 @@ class RefMethodConstLValueClass {
|
||||
|
||||
inline Cpp '''
|
||||
void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) {
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+7]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass', but function is not marked const [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | c.M();
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-8]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | fn M(ref self);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass', but function is not marked const [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
c.M();
|
||||
}
|
||||
|
||||
@@ -70,9 +70,7 @@ struct VBase {
|
||||
};
|
||||
''';
|
||||
|
||||
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+4]]:1: error: semantics TODO: `generic class deriving from C++ virtual class` [SemanticsTodo]
|
||||
// CHECK:STDERR: class GenericZ(T: type) {
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+2]]:1-25: error: semantics TODO: `generic class deriving from C++ virtual class` [SemanticsTodo]
|
||||
// CHECK:STDERR:
|
||||
class GenericZ(T: type) {
|
||||
extend base: Cpp.VBase;
|
||||
|
||||
@@ -34,12 +34,8 @@ class PrivateClass {
|
||||
|
||||
inline Cpp '''
|
||||
int PrivateStatic() {
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+7]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: 17 | return Carbon::PrivateClass::x;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-8]]:23: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 5 | private static var x: i32 = 123;
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+3]]:32: error: 'x' is a private member of 'Carbon::PrivateClass' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-6]]:23: note: implicitly declared private here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
return Carbon::PrivateClass::x;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user