| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- // 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/no_definition_in_impl_file.carbon
- // TIP: To dump output, run:
- // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_definition_in_impl_file.carbon
- // --- decl_in_api_definition_in_impl.carbon
- library "[[@TEST_NAME]]";
- class A;
- // --- decl_in_api_definition_in_impl.impl.carbon
- impl library "[[@TEST_NAME]]";
- class A;
- class A {}
- // --- use_decl_in_api.carbon
- library "[[@TEST_NAME]]";
- // --- use_decl_in_api.impl.carbon
- impl library "[[@TEST_NAME]]";
- import library "decl_in_api_definition_in_impl";
- // --- decl_only_in_api.carbon
- library "[[@TEST_NAME]]";
- class B;
- // --- decl_only_in_api.impl.carbon
- impl library "[[@TEST_NAME]]";
- // --- decl_in_api_decl_in_impl.carbon
- library "[[@TEST_NAME]]";
- class C;
- // --- fail_decl_in_api_decl_in_impl.impl.carbon
- impl library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_decl_in_api_decl_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl]
- // CHECK:STDERR: class C;
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR:
- class C;
- // --- decl_only_in_impl.carbon
- library "[[@TEST_NAME]]";
- // --- fail_decl_only_in_impl.impl.carbon
- impl library "[[@TEST_NAME]]";
- // CHECK:STDERR: fail_decl_only_in_impl.impl.carbon:[[@LINE+4]]:1: error: no definition found for declaration in impl file [MissingDefinitionInImpl]
- // CHECK:STDERR: class D;
- // CHECK:STDERR: ^~~~~~~~
- // CHECK:STDERR:
- class D;
- // CHECK:STDOUT: --- decl_in_api_definition_in_impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- decl_in_api_definition_in_impl.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %A: type = class_type @A [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: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = %A.decl.loc4
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_46.1 = import <none>
- // CHECK:STDOUT: %default.import.loc2_46.2 = import <none>
- // CHECK:STDOUT: %A.decl.loc4: type = class_decl @A [concrete = constants.%A] {} {}
- // CHECK:STDOUT: %A.decl.loc6: type = class_decl @A [concrete = constants.%A] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @A {
- // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
- // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
- // CHECK:STDOUT: complete_type_witness = %complete_type
- // CHECK:STDOUT:
- // CHECK:STDOUT: !members:
- // CHECK:STDOUT: .Self = constants.%A
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_decl_in_api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- use_decl_in_api.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.A = import_ref Main//decl_in_api_definition_in_impl, A, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .A = imports.%Main.A
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_31.1 = import <none>
- // CHECK:STDOUT: %default.import.loc2_31.2 = import <none>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- decl_only_in_api.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %B: type = class_type @B [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .B = %B.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %B.decl: type = class_decl @B [concrete = constants.%B] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @B;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- decl_only_in_api.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: %Main.B = import_ref Main//decl_only_in_api, B, unloaded
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .B = imports.%Main.B
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_32.1 = import <none>
- // CHECK:STDOUT: %default.import.loc2_32.2 = import <none>
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- decl_in_api_decl_in_impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // 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: --- fail_decl_in_api_decl_in_impl.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %C: type = class_type @C [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: imports {
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .C = %C.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_40.1 = import <none>
- // CHECK:STDOUT: %default.import.loc2_40.2 = import <none>
- // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @C;
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- decl_only_in_impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: --- fail_decl_only_in_impl.impl.carbon
- // CHECK:STDOUT:
- // CHECK:STDOUT: constants {
- // CHECK:STDOUT: %D: type = class_type @D [concrete]
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: file {
- // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
- // CHECK:STDOUT: .D = %D.decl
- // CHECK:STDOUT: }
- // CHECK:STDOUT: %default.import.loc2_33.1 = import <none>
- // CHECK:STDOUT: %default.import.loc2_33.2 = import <none>
- // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
- // CHECK:STDOUT: }
- // CHECK:STDOUT:
- // CHECK:STDOUT: class @D;
- // CHECK:STDOUT:
|