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:
Jon Ross-Perkins
2025-12-16 01:33:53 +00:00
committed by GitHub
parent 2a3d0b71bb
commit 47e551141f
453 changed files with 24276 additions and 24181 deletions
@@ -56,12 +56,12 @@ fn G() {
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define void @_CG.Main() #0 !dbg !12 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %CallGenericMethod.call = call i32 @_CCallGenericMethod.Main.dc54e41cb8a9bf68(i32 10), !dbg !15
// CHECK:STDOUT: %CallGenericMethod.call = call i32 @_CCallGenericMethod.Main.01bb5c52dbe55f94(i32 10), !dbg !15
// CHECK:STDOUT: ret void, !dbg !16
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.dc54e41cb8a9bf68(i32 %x) #0 !dbg !17 {
// CHECK:STDOUT: define linkonce_odr i32 @_CCallGenericMethod.Main.01bb5c52dbe55f94(i32 %x) #0 !dbg !17 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %SomeInterface.F.call = call i32 @"_CF.ImplsSomeInterface.Main:SomeInterface.Main"(i32 %x), !dbg !20
// CHECK:STDOUT: ret i32 %SomeInterface.F.call, !dbg !21
@@ -89,7 +89,7 @@ fn G() {
// CHECK:STDOUT: !14 = !{null}
// CHECK:STDOUT: !15 = !DILocation(line: 40, column: 3, scope: !12)
// CHECK:STDOUT: !16 = !DILocation(line: 39, column: 1, scope: !12)
// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "CallGenericMethod", linkageName: "_CCallGenericMethod.Main.dc54e41cb8a9bf68", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
// CHECK:STDOUT: !17 = distinct !DISubprogram(name: "CallGenericMethod", linkageName: "_CCallGenericMethod.Main.01bb5c52dbe55f94", scope: null, file: !3, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
// CHECK:STDOUT: !18 = !{!19}
// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !17, type: !7)
// CHECK:STDOUT: !20 = !DILocation(line: 36, column: 10, scope: !17)