mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-26 21:41:19 +00:00
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
727 lines
28 KiB
Plaintext
727 lines
28 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+11]]:4
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: -> │ fn C.F();
|
|
// CHECK:STDERR: · ┳
|
|
// CHECK:STDERR: · ┗━━┫ error: cannot declare a member of incomplete class `C`
|
|
// CHECK:STDERR: · ┃ [QualifiedDeclInIncompleteClassScope]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+10]]:1
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+10]]:1
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: -> │ class C;
|
|
// CHECK:STDERR: · ━━━━┳━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
class C;
|
|
|
|
// --- fail_extern_member_class.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C {
|
|
// CHECK:STDERR: ╭─┤ fail_extern_member_class.carbon:[[@LINE+7]]:3
|
|
// CHECK:STDERR: -> │ extern class D;
|
|
// CHECK:STDERR: · ━━━┳━━
|
|
// CHECK:STDERR: · ┗━━┫ error: `extern` not allowed; requires file or namespace scope
|
|
// CHECK:STDERR: · ┃ [ModifierExternNotAllowed]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+11]]:1
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: -> │ class C {}
|
|
// CHECK:STDERR: · ━━━━┳━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern`
|
|
// CHECK:STDERR: · ┃ [RedeclExternMismatch]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
class C {}
|
|
|
|
// --- fail_extern_decl_after_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
class C;
|
|
// CHECK:STDERR: ╭─┤ fail_extern_decl_after_decl.carbon:[[@LINE+88]]:1
|
|
// CHECK:STDERR: │ class C;
|
|
// CHECK:STDERR: · ────┬───
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_import_extern_decl_then_decl.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ decl.carbon:4:1
|
|
// CHECK:STDERR: -> │ class C;
|
|
// CHECK:STDERR: · ━━━━┳━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_import_decl_then_extern_decl.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon:4:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ decl.carbon
|
|
// CHECK:STDERR: │ class C;
|
|
// CHECK:STDERR: · ────┬───
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_import_extern_decl_then_def.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ def.carbon:4:1
|
|
// CHECK:STDERR: -> │ class C {}
|
|
// CHECK:STDERR: · ━━━━┳━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_import_ownership_conflict.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ decl.carbon:4:1
|
|
// CHECK:STDERR: -> │ class C;
|
|
// CHECK:STDERR: · ━━━━┳━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_import_ownership_conflict.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ def.carbon:4:1
|
|
// CHECK:STDERR: -> │ class C {}
|
|
// CHECK:STDERR: · ━━━━┳━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: ╷ ╭── imported from: fail_todo_import_extern_decl_copy.carbon [InImport]
|
|
// CHECK:STDERR: ├─┤ extern_decl_copy.carbon:4:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: duplicate name `C` being declared in the same scope
|
|
// CHECK:STDERR: · ┃ [NameDeclDuplicate]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ name is previously declared here [NameDeclPrevious]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
extern class C;
|
|
|
|
// --- fail_import_extern_decl_then_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "extern_decl";
|
|
import library "decl";
|
|
|
|
// --- fail_import_decl_then_extern_decl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "decl";
|
|
import library "extern_decl";
|
|
|
|
// --- fail_import_extern_decl_then_def.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "extern_decl";
|
|
import library "def";
|
|
|
|
// --- fail_import_ownership_conflict.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "extern_decl";
|
|
import library "decl";
|
|
import library "def";
|
|
|
|
// --- fail_todo_import_extern_decl_copy.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
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+11]]:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclaration of `class C` is redundant [RedeclRedundant]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ extern_decl.carbon
|
|
// CHECK:STDERR: │ extern class C;
|
|
// CHECK:STDERR: · ───────┬───────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+12]]:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern`
|
|
// CHECK:STDERR: · ┃ [RedeclExternMismatch]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ decl.carbon
|
|
// CHECK:STDERR: │ class C;
|
|
// CHECK:STDERR: · ────┬───
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+12]]:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern`
|
|
// CHECK:STDERR: · ┃ [RedeclExternMismatch]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ def.carbon
|
|
// CHECK:STDERR: │ class C {}
|
|
// CHECK:STDERR: · ────┬────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ╰────
|
|
// 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+12]]:1
|
|
// CHECK:STDERR: -> │ extern class C;
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: redeclarations of `class C` must match use of `extern`
|
|
// CHECK:STDERR: · ┃ [RedeclExternMismatch]
|
|
// CHECK:STDERR: ┆
|
|
// CHECK:STDERR: ├─┤ def.carbon
|
|
// CHECK:STDERR: │ class C {}
|
|
// CHECK:STDERR: · ────┬────
|
|
// CHECK:STDERR: · ╰──┤ previously declared here [RedeclPrevDecl]
|
|
// CHECK:STDERR: ╰────
|
|
// 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.loc15: 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.loc15
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc15: 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.loc16
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %C.decl.loc4: type = class_decl @C [concrete = constants.%C] {} {}
|
|
// CHECK:STDOUT: %C.decl.loc16: 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.loc93: 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:
|