mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 02:10:30 +00:00
Shorthand names are intended to be used in the textual format of references to instructions in another IR (which can't happen now, but will be possible in a forthcoming PR). The shorthand name uses the file name (minus the `.carbon` suffix) as a base, and if that base name is ambiguous within the compilation, it is given a numerical suffix `.N`, just like other textual IR names. Shorthand names are prefixed with `$` in the textual format, to distinguish them from inst and scope names. For example, a file `foo/bar.carbon` has the shorthand name `$bar`, and an instruction `@baz.%qux` in that file can be referenced from another file as `$bar.@baz.%qux`. This PR adds `toolchain/check/testdata/basics/file_name.carbon` to test this behavior. All other test changes are just applying this change to the existing textual SemIR dumps. --------- Co-authored-by: Dana Jansens <danakj@orodu.net>
619 lines
28 KiB
Plaintext
619 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/function/definition/import_access.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/import_access.carbon
|
|
|
|
// ============================================================================
|
|
// Setup files
|
|
// ============================================================================
|
|
|
|
// --- def.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
private fn Def() {}
|
|
|
|
// --- forward_with_def.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
private fn ForwardWithDef();
|
|
|
|
fn ForwardWithDef() {}
|
|
|
|
// --- forward.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
private fn Forward();
|
|
|
|
// ============================================================================
|
|
// Test files
|
|
// ============================================================================
|
|
|
|
// --- def.impl.carbon
|
|
|
|
impl package Test library "[[@TEST_NAME]]";
|
|
|
|
var f: () = Def();
|
|
|
|
// --- fail_local_def.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
import library "def";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_local_def.carbon:[[@LINE+6]]:13
|
|
// CHECK:STDERR: -> │ var f: () = Def();
|
|
// CHECK:STDERR: · ━┳━
|
|
// CHECK:STDERR: · ┗━━┫ error: name `Def` not found [NameNotFound]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = Def();
|
|
|
|
// --- fail_other_def.carbon
|
|
|
|
package Other library "[[@TEST_NAME]]";
|
|
|
|
import Test library "def";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_other_def.carbon:[[@LINE+7]]:13
|
|
// CHECK:STDERR: -> │ var f: () = Test.Def();
|
|
// CHECK:STDERR: · ━━━━┳━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: member name `Def` not found in `Test`
|
|
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = Test.Def();
|
|
|
|
// --- forward_with_def.impl.carbon
|
|
|
|
impl package Test library "[[@TEST_NAME]]";
|
|
|
|
var f: () = ForwardWithDef();
|
|
|
|
// --- fail_local_forward_with_def.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
import library "forward_with_def";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_local_forward_with_def.carbon:[[@LINE+6]]:13
|
|
// CHECK:STDERR: -> │ var f: () = ForwardWithDef();
|
|
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: name `ForwardWithDef` not found [NameNotFound]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = ForwardWithDef();
|
|
|
|
// --- fail_other_forward_with_def.carbon
|
|
|
|
package Other library "[[@TEST_NAME]]";
|
|
|
|
import Test library "forward_with_def";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_other_forward_with_def.carbon:[[@LINE+7]]:13
|
|
// CHECK:STDERR: -> │ var f: () = Test.ForwardWithDef();
|
|
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: member name `ForwardWithDef` not found in `Test`
|
|
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = Test.ForwardWithDef();
|
|
|
|
// --- forward.impl.carbon
|
|
|
|
impl package Test library "[[@TEST_NAME]]";
|
|
|
|
var f: () = Forward();
|
|
|
|
fn Forward() {}
|
|
|
|
// --- fail_local_forward.carbon
|
|
|
|
package Test library "[[@TEST_NAME]]";
|
|
|
|
import library "forward";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_local_forward.carbon:[[@LINE+6]]:13
|
|
// CHECK:STDERR: -> │ var f: () = Forward();
|
|
// CHECK:STDERR: · ━━━┳━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: name `Forward` not found [NameNotFound]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = Forward();
|
|
|
|
// --- fail_other_forward.carbon
|
|
|
|
package Other library "[[@TEST_NAME]]";
|
|
|
|
import Test library "forward";
|
|
|
|
// CHECK:STDERR: ╭─┤ fail_other_forward.carbon:[[@LINE+7]]:13
|
|
// CHECK:STDERR: -> │ var f: () = Test.Forward();
|
|
// CHECK:STDERR: · ━━━━━━┳━━━━━
|
|
// CHECK:STDERR: · ┗━━┫ error: member name `Forward` not found in `Test`
|
|
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: ╰────
|
|
// CHECK:STDERR:
|
|
var f: () = Test.Forward();
|
|
|
|
// --- todo_fail_private_on_redecl.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
private fn Redecl();
|
|
|
|
private fn Redecl() {}
|
|
|
|
// CHECK:STDOUT: --- def.carbon = $def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Def.type: type = fn_type @Def [concrete]
|
|
// CHECK:STDOUT: %Def: %Def.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Def [private] = %Def.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Def.decl: %Def.type = fn_decl @Def [concrete = constants.%Def] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Def() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- forward_with_def.carbon = $forward_with_def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %ForwardWithDef.type: type = fn_type @ForwardWithDef [concrete]
|
|
// CHECK:STDOUT: %ForwardWithDef: %ForwardWithDef.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .ForwardWithDef [private] = %ForwardWithDef.decl.loc4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %ForwardWithDef.decl.loc4: %ForwardWithDef.type = fn_decl @ForwardWithDef [concrete = constants.%ForwardWithDef] {} {}
|
|
// CHECK:STDOUT: %ForwardWithDef.decl.loc6: %ForwardWithDef.type = fn_decl @ForwardWithDef [concrete = constants.%ForwardWithDef] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @ForwardWithDef() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- forward.carbon = $forward
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Forward.type: type = fn_type @Forward [concrete]
|
|
// CHECK:STDOUT: %Forward: %Forward.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Forward [private] = %Forward.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Forward.decl: %Forward.type = fn_decl @Forward [concrete = constants.%Forward] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Forward();
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- def.impl.carbon = $def.impl
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: %Def.type: type = fn_type @Def [concrete]
|
|
// CHECK:STDOUT: %Def: %Def.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test.Def: %Def.type = import_ref Test//def, Def, loaded [concrete = constants.%Def]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Def [private] = imports.%Test.Def
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc4_9.1: type = splice_block %.loc4_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc4_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc4_9.3: type = converted %.loc4_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Def [from "def.carbon"];
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Def.ref: %Def.type = name_ref Def, imports.%Test.Def [concrete = constants.%Def]
|
|
// CHECK:STDOUT: %Def.call: init %empty_tuple.type = call %Def.ref()
|
|
// CHECK:STDOUT: assign file.%f.var, %Def.call
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_local_def.carbon = $fail_local_def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: .Def = <poisoned>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Def.ref: <error> = name_ref Def, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_other_def.carbon = $fail_other_def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test: <namespace> = namespace file.%Test.import, [concrete] {
|
|
// CHECK:STDOUT: .Def = <poisoned>
|
|
// CHECK:STDOUT: import Test//def
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Test = imports.%Test
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Test.ref: <namespace> = name_ref Test, imports.%Test [concrete = imports.%Test]
|
|
// CHECK:STDOUT: %Def.ref: <error> = name_ref Def, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- forward_with_def.impl.carbon = $forward_with_def.impl
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: %ForwardWithDef.type: type = fn_type @ForwardWithDef [concrete]
|
|
// CHECK:STDOUT: %ForwardWithDef: %ForwardWithDef.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test.ForwardWithDef: %ForwardWithDef.type = import_ref Test//forward_with_def, ForwardWithDef, loaded [concrete = constants.%ForwardWithDef]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .ForwardWithDef [private] = imports.%Test.ForwardWithDef
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc4_9.1: type = splice_block %.loc4_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc4_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc4_9.3: type = converted %.loc4_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @ForwardWithDef [from "forward_with_def.carbon"];
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %ForwardWithDef.ref: %ForwardWithDef.type = name_ref ForwardWithDef, imports.%Test.ForwardWithDef [concrete = constants.%ForwardWithDef]
|
|
// CHECK:STDOUT: %ForwardWithDef.call: init %empty_tuple.type = call %ForwardWithDef.ref()
|
|
// CHECK:STDOUT: assign file.%f.var, %ForwardWithDef.call
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_local_forward_with_def.carbon = $fail_local_forward_with_def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: .ForwardWithDef = <poisoned>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %ForwardWithDef.ref: <error> = name_ref ForwardWithDef, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_other_forward_with_def.carbon = $fail_other_forward_with_def
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test: <namespace> = namespace file.%Test.import, [concrete] {
|
|
// CHECK:STDOUT: .ForwardWithDef = <poisoned>
|
|
// CHECK:STDOUT: import Test//forward_with_def
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Test = imports.%Test
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Test.ref: <namespace> = name_ref Test, imports.%Test [concrete = imports.%Test]
|
|
// CHECK:STDOUT: %ForwardWithDef.ref: <error> = name_ref ForwardWithDef, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- forward.impl.carbon = $forward.impl
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: %Forward.type: type = fn_type @Forward [concrete]
|
|
// CHECK:STDOUT: %Forward: %Forward.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test.Forward: %Forward.type = import_ref Test//forward, Forward, loaded [concrete = constants.%Forward]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Forward [private] = %Forward.decl
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc4_9.1: type = splice_block %.loc4_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc4_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc4_9.3: type = converted %.loc4_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Forward.decl: %Forward.type = fn_decl @Forward [concrete = constants.%Forward] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Forward() [from "forward.carbon"] {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Forward.ref: %Forward.type = name_ref Forward, imports.%Test.Forward [concrete = constants.%Forward]
|
|
// CHECK:STDOUT: %Forward.call: init %empty_tuple.type = call %Forward.ref()
|
|
// CHECK:STDOUT: assign file.%f.var, %Forward.call
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_local_forward.carbon = $fail_local_forward
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: .Forward = <poisoned>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <none>
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Forward.ref: <error> = name_ref Forward, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- fail_other_forward.carbon = $fail_other_forward
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
|
|
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Test: <namespace> = namespace file.%Test.import, [concrete] {
|
|
// CHECK:STDOUT: .Forward = <poisoned>
|
|
// CHECK:STDOUT: import Test//forward
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Test = imports.%Test
|
|
// CHECK:STDOUT: .f = %f
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Test.import = import Test
|
|
// CHECK:STDOUT: %f.var: ref %empty_tuple.type = var_storage %f.var_patt [concrete]
|
|
// CHECK:STDOUT: %.loc13_9.1: type = splice_block %.loc13_9.3 [concrete = constants.%empty_tuple.type] {
|
|
// CHECK:STDOUT: %.loc13_9.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
|
|
// CHECK:STDOUT: %.loc13_9.3: type = converted %.loc13_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %f: ref %empty_tuple.type = wrapper_binding f, %f.var [concrete = %f.var]
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %f.patt: %pattern_type = ref_binding_pattern f [concrete = constants.%f.patt]
|
|
// CHECK:STDOUT: %f.var_patt: %pattern_type = var_pattern %f.patt [concrete = constants.%f.var_patt]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Test.ref: <namespace> = name_ref Test, imports.%Test [concrete = imports.%Test]
|
|
// CHECK:STDOUT: %Forward.ref: <error> = name_ref Forward, <error> [concrete = <error>]
|
|
// CHECK:STDOUT: assign file.%f.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- todo_fail_private_on_redecl.carbon = $todo_fail_private_on_redecl
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: type: type = facet_type <type> [concrete]
|
|
// CHECK:STDOUT: %Redecl.type: type = fn_type @Redecl [concrete]
|
|
// CHECK:STDOUT: %Redecl: %Redecl.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .Redecl [private] = %Redecl.decl.loc4
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Redecl.decl.loc4: %Redecl.type = fn_decl @Redecl [concrete = constants.%Redecl] {} {}
|
|
// CHECK:STDOUT: %Redecl.decl.loc6: %Redecl.type = fn_decl @Redecl [concrete = constants.%Redecl] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Redecl() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|