mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 05:38:10 +00:00
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
606 lines
23 KiB
Plaintext
606 lines
23 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
|
|
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
|
|
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/extern.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/extern.carbon
|
|
|
|
// ============================================================================
|
|
// Setup files
|
|
// ============================================================================
|
|
|
|
// --- decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C;
|
|
|
|
// --- extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
|
|
// --- extern_decl_copy.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
|
|
// --- def.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {}
|
|
|
|
// ============================================================================
|
|
// Test files
|
|
// ============================================================================
|
|
|
|
// --- fail_decl_fn_in_extern.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE+3]]:4: error: cannot declare a member of incomplete class `C` [QualifiedDeclInIncompleteClassScope]
|
|
// CHECK:STDERR: fail_decl_fn_in_extern.carbon:[[@LINE-2]]:1-15: note: class was forward declared here [ClassForwardDeclaredHere]
|
|
// CHECK:STDERR:
|
|
fn C.F();
|
|
|
|
// --- extern_def.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C {}
|
|
|
|
// --- fail_extern_decl_after_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: fail_extern_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_decl_after_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE+3]]:1-8: error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: fail_decl_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
class C;
|
|
|
|
// --- fail_extern_member_class.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {
|
|
// CHECK:STDERR: fail_extern_member_class.carbon:[[@LINE+2]]:3-8: error: `extern` not allowed; requires file or namespace scope [ModifierExternNotAllowed]
|
|
// CHECK:STDERR:
|
|
extern class D;
|
|
}
|
|
|
|
// --- fail_def_after_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
extern class C;
|
|
// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE+3]]:1-9: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch]
|
|
// CHECK:STDERR: fail_def_after_extern_decl.carbon:[[@LINE-2]]:1-15: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
class C {}
|
|
|
|
// --- fail_extern_decl_after_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C;
|
|
// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE+3]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: fail_extern_decl_after_decl.carbon:[[@LINE-2]]:1-8: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_import_extern_decl_then_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: imported from: fail_import_extern_decl_then_decl.carbon:[[@LINE+5]]:1 [InImport]
|
|
// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_import_extern_decl_then_decl.carbon:[[@LINE+3]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
import library "extern_decl";
|
|
import library "decl";
|
|
|
|
// --- fail_import_decl_then_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: imported from: fail_import_decl_then_extern_decl.carbon:[[@LINE+5]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_import_decl_then_extern_decl.carbon:[[@LINE+3]]:1 [InImport]
|
|
// CHECK:STDERR: decl.carbon:4:1-8: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
import library "decl";
|
|
import library "extern_decl";
|
|
|
|
// --- fail_import_extern_decl_then_def.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: imported from: fail_import_extern_decl_then_def.carbon:[[@LINE+5]]:1 [InImport]
|
|
// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_import_extern_decl_then_def.carbon:[[@LINE+3]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
import library "extern_decl";
|
|
import library "def";
|
|
|
|
// --- fail_import_ownership_conflict.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+10]]:1 [InImport]
|
|
// CHECK:STDERR: decl.carbon:4:1-8: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+8]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+5]]:1 [InImport]
|
|
// CHECK:STDERR: def.carbon:4:1-9: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_import_ownership_conflict.carbon:[[@LINE+3]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
import library "extern_decl";
|
|
import library "decl";
|
|
import library "def";
|
|
|
|
// --- fail_todo_import_extern_decl_copy.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
// CHECK:STDERR: imported from: fail_todo_import_extern_decl_copy.carbon:[[@LINE+5]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl_copy.carbon:4:1-15: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
|
|
// CHECK:STDERR: imported from: fail_todo_import_extern_decl_copy.carbon:[[@LINE+3]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR:
|
|
import library "extern_decl";
|
|
import library "extern_decl_copy";
|
|
|
|
// --- fail_extern_decl_after_import_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "extern_decl";
|
|
|
|
// CHECK:STDERR: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: imported from: fail_extern_decl_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport]
|
|
// CHECK:STDERR: extern_decl.carbon:4:1-15: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_decl_after_import_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "decl";
|
|
|
|
// CHECK:STDERR: fail_decl_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch]
|
|
// CHECK:STDERR: imported from: fail_decl_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport]
|
|
// CHECK:STDERR: decl.carbon:4:1-8: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_def_after_import_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "def";
|
|
|
|
// CHECK:STDERR: fail_def_after_import_extern_decl.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch]
|
|
// CHECK:STDERR: imported from: fail_def_after_import_extern_decl.carbon:[[@LINE-3]]:1 [InImport]
|
|
// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_extern_decl_after_import_def.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "def";
|
|
|
|
// CHECK:STDERR: fail_extern_decl_after_import_def.carbon:[[@LINE+4]]:1-15: error: redeclarations of `class C` must match use of `extern` [RedeclExternMismatch]
|
|
// CHECK:STDERR: imported from: fail_extern_decl_after_import_def.carbon:[[@LINE-3]]:1 [InImport]
|
|
// CHECK:STDERR: def.carbon:4:1-9: note: previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// CHECK:STDOUT: --- decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- extern_decl_copy.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- def.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_decl_fn_in_extern.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
|
|
// CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @F();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- extern_def.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_decl_after_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl.loc4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_decl_after_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl.loc8
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_member_class.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %D: type = class_type @D [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: .D = %D.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @D;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_def_after_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl.loc8
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C {
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_decl_after_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl.loc4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc8: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C;
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_import_extern_decl_then_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.C = import_ref Main//extern_decl, C, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = imports.%Main.C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_import_decl_then_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.C = import_ref Main//decl, C, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = imports.%Main.C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_import_extern_decl_then_def.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.C = import_ref Main//extern_decl, C, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = imports.%Main.C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_import_ownership_conflict.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.C = import_ref Main//extern_decl, C, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = imports.%Main.C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_todo_import_extern_decl_copy.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.C = import_ref Main//extern_decl, C, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = imports.%Main.C
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_decl_after_import_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C [from "extern_decl.carbon"];
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_decl_after_import_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C [from "decl.carbon"];
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_def_after_import_extern_decl.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//def, loc4_10, loaded [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: %Main.import_ref.e47 = import_ref Main//def, inst{{[0-9A-F]+}} [no loc], unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C [from "def.carbon"] {
|
|
// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%Main.import_ref.e47
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_extern_decl_after_import_def.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %C: type = class_type @C [concrete]
|
|
// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//def, loc4_10, loaded [concrete = constants.%complete_type]
|
|
// CHECK:STDOUT: %Main.import_ref.e47 = import_ref Main//def, inst{{[0-9A-F]+}} [no loc], unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .C = %C.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @C [from "def.carbon"] {
|
|
// CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%Main.import_ref.e47
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|