mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 07:01:04 +01:00
131 lines
4.7 KiB
Plaintext
131 lines
4.7 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
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/export_name.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/export_name.carbon
|
|
|
|
// ============================================================================
|
|
// Setup files
|
|
// ============================================================================
|
|
|
|
// --- base.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
interface I {}
|
|
|
|
// --- export.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "base";
|
|
|
|
export I;
|
|
|
|
// ============================================================================
|
|
// Test files
|
|
// ============================================================================
|
|
|
|
// --- use_export.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import library "export";
|
|
|
|
fn UseEmpty(i: I) {}
|
|
|
|
// CHECK:STDOUT: --- base.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %I.type: type = interface_type @I [template]
|
|
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .I = %I.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @I {
|
|
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = %Self
|
|
// CHECK:STDOUT: witness = ()
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- export.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %I.type: type = interface_type @I [template]
|
|
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%I.type]
|
|
// CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+3, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .I = %I
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <invalid>
|
|
// CHECK:STDOUT: %I: type = export I, imports.%import_ref.1 [template = constants.%I.type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @I {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.2
|
|
// CHECK:STDOUT: witness = ()
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- use_export.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %I.type: type = interface_type @I [template]
|
|
// CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
|
|
// CHECK:STDOUT: %UseEmpty.type: type = fn_type @UseEmpty [template]
|
|
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %UseEmpty: %UseEmpty.type = struct_value () [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %import_ref.1: type = import_ref Main//export, inst+7, loaded [template = constants.%I.type]
|
|
// CHECK:STDOUT: %import_ref.2 = import_ref Main//export, inst+6, unloaded
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .I = imports.%import_ref.1
|
|
// CHECK:STDOUT: .UseEmpty = %UseEmpty.decl
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %default.import = import <invalid>
|
|
// CHECK:STDOUT: %UseEmpty.decl: %UseEmpty.type = fn_decl @UseEmpty [template = constants.%UseEmpty] {
|
|
// CHECK:STDOUT: %i.patt: %I.type = binding_pattern i
|
|
// CHECK:STDOUT: %i.param_patt: %I.type = value_param_pattern %i.patt, runtime_param0
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: %I.ref: type = name_ref I, imports.%import_ref.1 [template = constants.%I.type]
|
|
// CHECK:STDOUT: %i.param: %I.type = value_param runtime_param0
|
|
// CHECK:STDOUT: %i: %I.type = bind_name i, %i.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: interface @I {
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = imports.%import_ref.2
|
|
// CHECK:STDOUT: witness = ()
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @UseEmpty(%i.param_patt: %I.type) {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|