mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 10:15:01 +01:00
Fix import logic to make all imported packages be children of the `NameScopeId::Package` scope. Previously, indirectly-imported packages would end up as children of their importing package's scope, which resulted in them not being treated as packages at all, and in particular not being fingerprinted as packages. Fixing that caused a failure in the fingerprinting logic as we started to encounter packages with no correspoding import scopes. Instead of looking for import scopes, use a simpler mechanism to map packages to their package names, and clean up. Unfortunately the latter change churns all the fingerprints again :( Hopefully this is the last time for a while.
68 lines
2.7 KiB
Plaintext
68 lines
2.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
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/partial/init.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/partial/init.carbon
|
|
|
|
// --- base.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
base class Base {
|
|
fn Make() -> partial Self {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
class Derived {
|
|
extend base: Base;
|
|
fn Make() -> Self {
|
|
//@dump-sem-ir-begin
|
|
return {.base = Base.Make()};
|
|
//@dump-sem-ir-end
|
|
}
|
|
}
|
|
|
|
// CHECK:STDOUT: --- base.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Base: type = class_type @Base [concrete]
|
|
// CHECK:STDOUT: %.edf: type = partial_type %Base [concrete]
|
|
// CHECK:STDOUT: %Base.Make.type: type = fn_type @Base.Make [concrete]
|
|
// CHECK:STDOUT: %Base.Make: %Base.Make.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
|
|
// CHECK:STDOUT: %struct_type.base.343: type = struct_type {.base: %.edf} [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: class @Derived {
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: complete_type_witness = %complete_type
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: !members:
|
|
// CHECK:STDOUT: .Self = constants.%Derived
|
|
// CHECK:STDOUT: .Base = <poisoned>
|
|
// CHECK:STDOUT: .base = %.loc11
|
|
// CHECK:STDOUT: .Make = %Derived.Make.decl
|
|
// CHECK:STDOUT: extend %Base.ref
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Derived.Make() -> out %return.param: %Derived {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [concrete = constants.%Base]
|
|
// CHECK:STDOUT: %Make.ref: %Base.Make.type = name_ref Make, @Base.%Base.Make.decl [concrete = constants.%Base.Make]
|
|
// CHECK:STDOUT: %.loc14_32.1: ref %.edf = class_element_access %return.param, element0
|
|
// CHECK:STDOUT: %Base.Make.call: init %.edf to %.loc14_32.1 = call %Make.ref()
|
|
// CHECK:STDOUT: %.loc14_32.2: %struct_type.base.343 = struct_literal (%Base.Make.call)
|
|
// CHECK:STDOUT: %.loc14_32.3: init %Base = as_compatible %Base.Make.call
|
|
// CHECK:STDOUT: %.loc14_32.4: init %Derived to %return.param = class_init (%.loc14_32.3)
|
|
// CHECK:STDOUT: %.loc14_33: init %Derived = converted %.loc14_32.2, %.loc14_32.4
|
|
// CHECK:STDOUT: return %.loc14_33 to %return.param
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|