Files
carbon-lang/toolchain/check/testdata/var/no_prelude/import.carbon
T
Geoff RomerandRichard Smith a112cbde5c Model type expressions as regions (#4698)
This is a precondition for enabling the new pattern-matching subsystem
to support binding patterns that have `if` expressions in the type
position.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-12-19 21:41:06 +00:00

78 lines
3.1 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/var/no_prelude/import.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/import.carbon
// --- implicit.carbon
package Implicit;
var a_ref: () = ();
// --- implicit.impl.carbon
impl package Implicit;
var a: () = a_ref;
// CHECK:STDOUT: --- implicit.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .a_ref = %a_ref
// CHECK:STDOUT: }
// CHECK:STDOUT: %a_ref.var: ref %empty_tuple.type = var a_ref
// CHECK:STDOUT: %a_ref: ref %empty_tuple.type = bind_name a_ref, %a_ref.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc4_18.1: %empty_tuple.type = tuple_literal ()
// CHECK:STDOUT: %.loc4_18.2: init %empty_tuple.type = tuple_init () to file.%a_ref.var [template = constants.%empty_tuple]
// CHECK:STDOUT: %.loc4_19: init %empty_tuple.type = converted %.loc4_18.1, %.loc4_18.2 [template = constants.%empty_tuple]
// CHECK:STDOUT: assign file.%a_ref.var, %.loc4_19
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: --- implicit.impl.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %import_ref: ref %empty_tuple.type = import_ref Implicit//default, a_ref, loaded
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .a_ref = imports.%import_ref
// CHECK:STDOUT: .a = %a
// CHECK:STDOUT: }
// CHECK:STDOUT: %Implicit.import = import Implicit
// CHECK:STDOUT: %default.import = import <invalid>
// CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
// CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a_ref.ref: ref %empty_tuple.type = name_ref a_ref, imports.%import_ref
// CHECK:STDOUT: %.loc4_13: init %empty_tuple.type = tuple_init () to file.%a.var [template = constants.%empty_tuple]
// CHECK:STDOUT: %.loc4_18: init %empty_tuple.type = converted %a_ref.ref, %.loc4_13 [template = constants.%empty_tuple]
// CHECK:STDOUT: assign file.%a.var, %.loc4_18
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: