mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 07:08:10 +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
+46
-126
@@ -22,10 +22,8 @@
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_one_error.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_error.h";
|
||||
|
||||
@@ -42,15 +40,11 @@ import Cpp library "one_error.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors.h:3:2: error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: 3 | #error "error2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multiple_errors.h";
|
||||
|
||||
@@ -67,10 +61,8 @@ import Cpp library "multiple_errors.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_cpp_file_with_one_warning.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_cpp_file_with_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_warning.h";
|
||||
//@dump-sem-ir-end
|
||||
@@ -90,20 +82,14 @@ import Cpp library "one_warning.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multiple_warnings.h";
|
||||
//@dump-sem-ir-end
|
||||
@@ -121,15 +107,11 @@ import Cpp library "multiple_warnings.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "one_error_and_one_warning.h";
|
||||
|
||||
@@ -149,30 +131,20 @@ import Cpp library "one_error_and_one_warning.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+25]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+20]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+12]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: 3 | #error "error2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 5 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
@@ -195,26 +167,18 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multi_one_warning.h";
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multi_multiple_warnings.h";
|
||||
//@dump-sem-ir-end
|
||||
@@ -240,41 +204,27 @@ import Cpp library "multi_multiple_warnings.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 3 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multi_one_error_and_one_warning.h";
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+25]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+20]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+12]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: 3 | #error "error2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 4 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+10]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 5 | #warning "warning2"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 6 | #warning "warning3"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
@@ -294,11 +244,9 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_indirect_error.carbon:[[@LINE+6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_error.h:2:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_indirect_error.carbon:[[@LINE+4]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: included from: ./indirect_error.h:2:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_one_error.h:2:2: error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | #error "error1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "indirect_error.h";
|
||||
|
||||
@@ -319,11 +267,9 @@ import Cpp library "indirect_error.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// CHECK:STDERR: import_indirect_warning.carbon:[[@LINE+6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_warning.h:2:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: import_indirect_warning.carbon:[[@LINE+4]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: included from: ./indirect_warning.h:2:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "indirect_warning.h";
|
||||
//@dump-sem-ir-end
|
||||
@@ -343,14 +289,10 @@ library "[[@TEST_NAME]]";
|
||||
//!Lexer error: whitespace is required after the comment introducer.
|
||||
|
||||
// TODO: Move this warning to be after the lexer error.
|
||||
// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE+9]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_cpp_library_lexer_error.carbon:[[@LINE+5]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./lexer_error_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: 2 | #warning "warning1"
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-8]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
|
||||
// CHECK:STDERR: //!Lexer error: whitespace is required after the comment introducer.
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-6]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "lexer_error_one_warning.h";
|
||||
|
||||
@@ -366,18 +308,14 @@ double score = 0.1
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+6]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: included from: fail_import_fix_it_hints.carbon:[[@LINE+4]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./fix_it_hints.h:2:19: error: expected ';' after top level declarator [CppInteropParseError]
|
||||
// CHECK:STDERR: 2 | double score = 0.1
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: | ;
|
||||
// CHECK:STDERR: ./fix_it_hints.h:2:19: note: insert `;` here [CppInteropFixItInsertion]
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "fix_it_hints.h";
|
||||
|
||||
fn F() {
|
||||
// CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+4]]:3: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: Cpp.foo();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+2]]:3-9: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo();
|
||||
}
|
||||
@@ -398,14 +336,10 @@ inline void call_foobar() {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_with_notes.carbon:[[@LINE+9]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./with_notes.h:5:3: error: no matching function for call to 'foobar' [CppInteropParseError]
|
||||
// CHECK:STDERR: 5 | foobar(1, 2);
|
||||
// CHECK:STDERR: | ^~~~~~
|
||||
// CHECK:STDERR: fail_with_notes.carbon:[[@LINE+5]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable: requires 1 argument, but 2 were provided [CppInteropParseNote]
|
||||
// CHECK:STDERR: 2 | void foobar(int);
|
||||
// CHECK:STDERR: | ^ ~~~
|
||||
// CHECK:STDERR: included from: fail_with_notes.carbon:[[@LINE+5]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: ./with_notes.h:5:3-8: error: no matching function for call to 'foobar' [CppInteropParseError]
|
||||
// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable [CppInteropParseNote]
|
||||
// CHECK:STDERR: ./with_notes.h:2:13-15: note: requires 1 argument, but 2 were provided [CppInteropParseNoteReason]
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "with_notes.h";
|
||||
|
||||
@@ -434,20 +368,12 @@ FOO
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_use_context_stack.carbon:[[@LINE+15]]:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./direct_include.h:4:10: in file included here [InCppInclude]
|
||||
// CHECK:STDERR: ./indirect_include.h:2:13: in expansion of macro defined here [InCppMacroExpansion]
|
||||
// CHECK:STDERR: ./direct_include.h:2:13: in expansion of macro defined here [InCppMacroExpansion]
|
||||
// CHECK:STDERR: ./indirect_include.h:3:20: in expansion of macro defined here [InCppMacroExpansion]
|
||||
// CHECK:STDERR: included from: fail_use_context_stack.carbon:[[@LINE+7]]:10 [InCppInclude]
|
||||
// CHECK:STDERR: included from: ./direct_include.h:4:10 [InCppInclude]
|
||||
// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:2:13 [InCppMacroExpansion]
|
||||
// CHECK:STDERR: expanded from macro defined at: ./direct_include.h:2:13 [InCppMacroExpansion]
|
||||
// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:3:20 [InCppMacroExpansion]
|
||||
// CHECK:STDERR: ./indirect_include.h:5:1: error: unknown type name 'error' [CppInteropParseError]
|
||||
// CHECK:STDERR: 5 | FOO
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: 2 | #define FOO BAR
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: 2 | #define BAR BAZ
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR: 3 | #define BAZ void f(error);
|
||||
// CHECK:STDERR: | ^
|
||||
// CHECK:STDERR:
|
||||
import Cpp library "direct_include.h";
|
||||
|
||||
@@ -459,9 +385,7 @@ import Cpp library "direct_include.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+4]]:9: error: use of undeclared identifier 'banana' [CppInteropParseError]
|
||||
// CHECK:STDERR: 8 | int n = banana;
|
||||
// CHECK:STDERR: | ^~~~~~
|
||||
// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+2]]:9-14: error: use of undeclared identifier 'banana' [CppInteropParseError]
|
||||
// CHECK:STDERR:
|
||||
import Cpp inline "int n = banana;";
|
||||
|
||||
@@ -469,12 +393,8 @@ import Cpp inline "int n = banana;";
|
||||
|
||||
import Cpp inline '''c++
|
||||
void f(const int n) {
|
||||
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+7]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError]
|
||||
// CHECK:STDERR: 11 | ++n;
|
||||
// CHECK:STDERR: | ^ ~
|
||||
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-4]]:18: note: variable 'n' declared const here [CppInteropParseNote]
|
||||
// CHECK:STDERR: 3 | void f(const int n) {
|
||||
// CHECK:STDERR: | ~~~~~~~~~~^
|
||||
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+3]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError]
|
||||
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-2]]:8-18: note: variable 'n' declared const here [CppInteropParseNote]
|
||||
// CHECK:STDERR:
|
||||
++n;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user