compileAndImportPkg(t, "issue25596")
}
+func TestIssue70394(t *testing.T) {
+ testenv.MustHaveGoBuild(t)
+
+ // This package only handles gc export data.
+ if runtime.Compiler != "gc" {
+ t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
+ }
+
+ pkg := compileAndImportPkg(t, "alias")
+ obj := lookupObj(t, pkg.Scope(), "A")
+
+ typ := obj.Type()
+ if _, ok := typ.(*types2.Alias); !ok {
+ t.Fatalf("type of %s is %s, wanted an alias", obj, typ)
+ }
+}
+
func importPkg(t *testing.T, path, srcDir string) *types2.Package {
pkg, err := Import(make(map[string]*types2.Package), path, srcDir, nil)
if err != nil {
--- /dev/null
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package testdata
+
+type A = int32
pr := pkgReader{
PkgDecoder: input,
- ctxt: ctxt,
- imports: imports,
- // Currently, the compiler panics when using Alias types.
- // TODO(gri) set to true once this is fixed (issue #66873)
- enableAlias: false,
+ ctxt: ctxt,
+ imports: imports,
+ enableAlias: true,
posBases: make([]*syntax.PosBase, input.NumElems(pkgbits.RelocPosBase)),
pkgs: make([]*types2.Package, input.NumElems(pkgbits.RelocPkg)),