mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:41:27 +01:00
Change the package namespace to use the package name (#6495)
Instead of naming the root namespace `package` (because it's accessed by the `package` keyword), change it to use the current package name. Note, buried in the checksum changes, `toolchain/check/testdata/package_expr/fail_not_found.carbon`: ``` - // CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:16: error: member name `x` not found in `package` [MemberNameNotFoundInInstScope] + // CHECK:STDERR: fail_not_found.carbon:[[@LINE+4]]:16: error: member name `x` not found in `Main` [MemberNameNotFoundInInstScope] ``` for: ``` // CHECK:STDERR: var y: i32 = package.x; // CHECK:STDERR: ^~~~~~~~~ ``` I'll leave it to you if you prefer this; the alternative I see is to just rename `IsCorePackage` to `IsImportedCorePackage`, and/or change it to a helper that takes a `Context` and does the right thing with `parse_tree` (which, I need for `Destroy`-related reasons and was my default approach).
This commit is contained in:
@@ -103,11 +103,11 @@ fn F() {
|
||||
// CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.be4: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.b5e: %Core.IntLiteral.as.As.impl.Convert.type.be4 = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %As.impl_witness.f60: <witness> = impl_witness imports.%As.impl_witness_table.de3, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %As.impl_witness.d70: <witness> = impl_witness imports.%As.impl_witness_table.026, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.432: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.f1b: %Core.IntLiteral.as.As.impl.Convert.type.432 = struct_value () [concrete]
|
||||
// CHECK:STDOUT: %As.facet: %As.type.771 = facet_value Core.IntLiteral, (%As.impl_witness.f60) [concrete]
|
||||
// CHECK:STDOUT: %.4d2: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet [concrete]
|
||||
// CHECK:STDOUT: %As.facet: %As.type.771 = facet_value Core.IntLiteral, (%As.impl_witness.d70) [concrete]
|
||||
// CHECK:STDOUT: %.462: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.f1b [concrete]
|
||||
// CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.f1b, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
|
||||
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_42.20e, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
|
||||
@@ -127,8 +127,8 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Enum.decl: type = class_decl @Enum [concrete = constants.%Enum] {} {}
|
||||
// CHECK:STDOUT: %int_0: %Enum = int_value 0 [concrete = constants.%int_0.420]
|
||||
// CHECK:STDOUT: %Core.import_ref.ef2: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.be4) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.b5e)]
|
||||
// CHECK:STDOUT: %As.impl_witness_table.de3 = impl_witness_table (%Core.import_ref.ef2), @Core.IntLiteral.as.As.impl [concrete]
|
||||
// CHECK:STDOUT: %Core.import_ref.452: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.be4) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.b5e)]
|
||||
// CHECK:STDOUT: %As.impl_witness_table.026 = impl_witness_table (%Core.import_ref.452), @Core.IntLiteral.as.As.impl [concrete]
|
||||
// CHECK:STDOUT: %Other.decl: type = class_decl @Other [concrete = constants.%Other] {} {}
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
@@ -159,7 +159,7 @@ fn F() {
|
||||
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42.20e]
|
||||
// CHECK:STDOUT: %int_16.loc9: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
|
||||
// CHECK:STDOUT: %i16.loc9: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
|
||||
// CHECK:STDOUT: %impl.elem0: %.4d2 = impl_witness_access constants.%As.impl_witness.f60, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.f1b]
|
||||
// CHECK:STDOUT: %impl.elem0: %.462 = impl_witness_access constants.%As.impl_witness.d70, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.f1b]
|
||||
// CHECK:STDOUT: %bound_method.loc9_25.1: <bound method> = bound_method %int_42, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
|
||||
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
|
||||
// CHECK:STDOUT: %bound_method.loc9_25.2: <bound method> = bound_method %int_42, %specific_fn [concrete = constants.%bound_method]
|
||||
|
||||
Reference in New Issue
Block a user