mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 09:58:10 +00:00
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:
1 parent
0b7059a360
commit
d0badecd2a
888 files changed
+39731
-12799
No files matched your search
+262
-108
@@ -16,15 +16,19 @@
|
||||
|
||||
// --- one_error.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./one_error.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
|
||||
// --- fail_import_cpp_file_with_one_error.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
import Cpp library "one_error.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -33,19 +37,27 @@ import Cpp library "one_error.h";
|
||||
|
||||
// --- multiple_errors.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error2"
|
||||
|
||||
// --- fail_import_cpp_file_with_multiple_errors.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multiple_errors.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -54,6 +66,13 @@ import Cpp library "multiple_errors.h";
|
||||
|
||||
// --- one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_one_warning.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- import_cpp_file_with_one_warning.carbon
|
||||
@@ -61,9 +80,6 @@ import Cpp library "multiple_errors.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// 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:
|
||||
import Cpp library "one_warning.h";
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -73,8 +89,29 @@ import Cpp library "one_warning.h";
|
||||
|
||||
// --- multiple_warnings.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning3"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning3"
|
||||
|
||||
// --- import_cpp_file_with_multiple_warnings.carbon
|
||||
@@ -82,15 +119,6 @@ import Cpp library "one_warning.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multiple_warnings.h";
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -100,19 +128,27 @@ import Cpp library "multiple_warnings.h";
|
||||
|
||||
// --- one_error_and_one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- fail_import_cpp_file_with_one_error_and_one_warning.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "one_error_and_one_warning.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -121,31 +157,51 @@ import Cpp library "one_error_and_one_warning.h";
|
||||
|
||||
// --- multiple_errors_and_multiple_warnings.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning3"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning3"
|
||||
|
||||
// --- fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -154,12 +210,40 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
// --- multi_one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- multi_multiple_warnings.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning3"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning3"
|
||||
|
||||
// --- import_multiple_cpp_files_with_warnings.carbon
|
||||
@@ -167,19 +251,7 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// 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:
|
||||
import Cpp library "multi_one_warning.h";
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multi_multiple_warnings.h";
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -189,43 +261,71 @@ import Cpp library "multi_multiple_warnings.h";
|
||||
|
||||
// --- multi_one_error_and_one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- multi_multiple_errors_and_multiple_warnings.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning2"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning2"
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning3"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning3"
|
||||
|
||||
// --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multi_one_error_and_one_warning.h";
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
// 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:
|
||||
import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -234,6 +334,14 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
// --- indirect_one_error.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_indirect_error.carbon [InCppInclude]
|
||||
// CHECK:STDERR: │ ├── included from: ./indirect_error.h [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./indirect_one_error.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #error "error1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#error "error1"
|
||||
|
||||
// --- indirect_error.h
|
||||
@@ -244,10 +352,6 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
import Cpp library "indirect_error.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -256,6 +360,14 @@ import Cpp library "indirect_error.h";
|
||||
|
||||
// --- indirect_one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: import_indirect_warning.carbon [InCppInclude]
|
||||
// CHECK:STDERR: │ ├── included from: ./indirect_warning.h [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./indirect_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- indirect_warning.h
|
||||
@@ -267,10 +379,6 @@ import Cpp library "indirect_error.h";
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
//@dump-sem-ir-begin
|
||||
// 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:
|
||||
import Cpp library "indirect_warning.h";
|
||||
//@dump-sem-ir-end
|
||||
|
||||
@@ -280,20 +388,29 @@ import Cpp library "indirect_warning.h";
|
||||
|
||||
// --- lexer_error_one_warning.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_library_lexer_error.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./lexer_error_one_warning.h:[[@LINE+6]]:2
|
||||
// CHECK:STDERR: -> │ #warning "warning1"
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
#warning "warning1"
|
||||
|
||||
// --- fail_import_cpp_library_lexer_error.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_lexer_error.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ //!Lexer error: whitespace is required after the comment introducer.
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//'
|
||||
// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
//!Lexer error: whitespace is required after the comment introducer.
|
||||
|
||||
// TODO: Move this warning to be after the lexer error.
|
||||
// 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:
|
||||
// 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";
|
||||
|
||||
// ============================================================================
|
||||
@@ -302,20 +419,30 @@ import Cpp library "lexer_error_one_warning.h";
|
||||
|
||||
// --- fix_it_hints.h
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_import_fix_it_hints.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./fix_it_hints.h:[[@LINE+8]]:19
|
||||
// CHECK:STDERR: -> │ double score = 0.1
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: expected ';' after top level declarator
|
||||
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
|
||||
// CHECK:STDERR: · ╰────┤ insert `;` here [CppInteropFixItInsertion]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
double score = 0.1
|
||||
|
||||
// --- fail_import_fix_it_hints.carbon
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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: ./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+2]]:3-9: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╭─┤ fail_import_fix_it_hints.carbon:[[@LINE+7]]:3
|
||||
// CHECK:STDERR: -> │ Cpp.foo();
|
||||
// CHECK:STDERR: · ━━━┳━━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp`
|
||||
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
Cpp.foo();
|
||||
}
|
||||
@@ -329,6 +456,20 @@ fn F() {
|
||||
void foobar(int);
|
||||
|
||||
inline void call_foobar() {
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_with_notes.carbon [InCppInclude]
|
||||
// CHECK:STDERR: ├─┤ ./with_notes.h:[[@LINE+13]]:3
|
||||
// CHECK:STDERR: │ void foobar(int);
|
||||
// CHECK:STDERR: · ┬ ─┬─
|
||||
// CHECK:STDERR: · ╰──────────┤ candidate function not viable [CppInteropParseNote]
|
||||
// CHECK:STDERR: · ╰────┤ requires 1 argument, but 2 were provided
|
||||
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ foobar(1, 2);
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'foobar'
|
||||
// CHECK:STDERR: · ┃ [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
foobar(1, 2);
|
||||
}
|
||||
|
||||
@@ -336,11 +477,6 @@ inline void call_foobar() {
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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";
|
||||
|
||||
fn F() {
|
||||
@@ -356,6 +492,17 @@ fn F() {
|
||||
#define FOO BAR
|
||||
#define BAZ void f(error);
|
||||
|
||||
// CHECK:STDERR: ╷ ╭── included from: fail_use_context_stack.carbon [InCppInclude]
|
||||
// CHECK:STDERR: │ ├── included from: ./direct_include.h [InCppInclude]
|
||||
// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion]
|
||||
// CHECK:STDERR: │ ├── expanded from macro defined at: ./direct_include.h [InCppMacroExpansion]
|
||||
// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion]
|
||||
// CHECK:STDERR: ├─┤ ./indirect_include.h:[[@LINE+6]]:1
|
||||
// CHECK:STDERR: -> │ #define BAZ void f(error);
|
||||
// CHECK:STDERR: · ┳
|
||||
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'error' [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
FOO
|
||||
|
||||
// --- direct_include.h
|
||||
@@ -368,13 +515,6 @@ FOO
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// 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:
|
||||
import Cpp library "direct_include.h";
|
||||
|
||||
// ============================================================================
|
||||
@@ -385,7 +525,12 @@ import Cpp library "direct_include.h";
|
||||
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+2]]:9-14: error: use of undeclared identifier 'banana' [CppInteropParseError]
|
||||
// CHECK:STDERR: ╭─┤ fail_loc_in_inline_simple.carbon:[[@LINE+7]]:9
|
||||
// CHECK:STDERR: -> │ int n = banana;
|
||||
// CHECK:STDERR: · ━━━┳━━
|
||||
// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'banana'
|
||||
// CHECK:STDERR: · ┃ [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
import Cpp inline "int n = banana;";
|
||||
|
||||
@@ -393,8 +538,17 @@ import Cpp inline "int n = banana;";
|
||||
|
||||
import Cpp inline '''c++
|
||||
void f(const int n) {
|
||||
// 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: ╭─┤ fail_loc_in_inline_block.carbon:[[@LINE+12]]:3
|
||||
// CHECK:STDERR: │ void f(const int n) {
|
||||
// CHECK:STDERR: · ─────┬─────
|
||||
// CHECK:STDERR: · ╰──┤ variable 'n' declared const here [CppInteropParseNote]
|
||||
// CHECK:STDERR: ┆
|
||||
// CHECK:STDERR: -> │ ++n;
|
||||
// CHECK:STDERR: · ┳ ─
|
||||
// CHECK:STDERR: · ┗━━┫ error: cannot assign to variable 'n' with const-qualified type 'const
|
||||
// CHECK:STDERR: · ┃ int'
|
||||
// CHECK:STDERR: · ┃ [CppInteropParseError]
|
||||
// CHECK:STDERR: ╰────
|
||||
// CHECK:STDERR:
|
||||
++n;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user