]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.typeparams] cmd/compile/internal/types2: fix a bug in package qualification...
authorRobert Griesemer <gri@golang.org>
Wed, 21 Jul 2021 23:36:49 +0000 (16:36 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 26 Jul 2021 20:53:13 +0000 (20:53 +0000)
This is a partial port of https://golang.org/cl/330629, containing
only the actual bug fix and adjustements to another test file.

The respective test case has not been ported yet as it requires
some bigger adjustments.

For #46905

Change-Id: Ibd20658b8a31855da20cf56e24bcce9560656ca0
Reviewed-on: https://go-review.googlesource.com/c/go/+/336350
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/compile/internal/types2/errors.go
src/cmd/compile/internal/types2/testdata/check/issues.src
test/run.go

index af4ecb2300a58cbfe5e8eeae32220fe72129ba2d..8c5e185f6cb958596f9af28080dac9faace7c8af 100644 (file)
@@ -111,7 +111,7 @@ func (check *Checker) qualifier(pkg *Package) string {
                if check.pkgPathMap == nil {
                        check.pkgPathMap = make(map[string]map[string]bool)
                        check.seenPkgMap = make(map[*Package]bool)
-                       check.markImports(pkg)
+                       check.markImports(check.pkg)
                }
                // If the same package name was used by multiple packages, display the full path.
                if len(check.pkgPathMap[pkg.name]) > 1 {
index 60d23b3c3bc51ec5b2a09d27ceb5ade9fef45dd7..7219a560b1c02a3420eef38bcb1db7d2bbcfbd40 100644 (file)
@@ -332,7 +332,7 @@ func issue28281g() (... /* ERROR can only use ... with final parameter in list *
 func issue26234a(f *syn.File) {
        // The error message below should refer to the actual package name (syntax)
        // not the local package name (syn).
-       f.foo /* ERROR f.foo undefined \(type \*syntax.File has no field or method foo\) */
+       f.foo /* ERROR f\.foo undefined \(type \*syntax\.File has no field or method foo\) */
 }
 
 type T struct {
@@ -361,7 +361,7 @@ func issue35895() {
 
        // Because both t1 and t2 have the same global package name (template),
        // qualify packages with full path name in this case.
-       var _ t1.Template = t2 /* ERROR cannot use .* \(value of type "html/template".Template\) as "text/template".Template */ .Template{}
+       var _ t1.Template = t2 /* ERROR cannot use .* \(value of type .html/template.\.Template\) as .text/template.\.Template */ .Template{}
 }
 
 func issue42989(s uint) {
index 2e72d55b7610d722e1e0706e91197c6638fc2f06..edf26a5d82d208669d9d9f0ab70ae39e1a11e146 100644 (file)
@@ -2140,7 +2140,6 @@ var types2Failures = setOf(
        "fixedbugs/issue11610.go",  // types2 not run after syntax errors
        "fixedbugs/issue11614.go",  // types2 reports an extra error
        "fixedbugs/issue14520.go",  // missing import path error by types2
-       "fixedbugs/issue16133.go",  // types2 doesn't use package path for qualified identifiers when package name is ambiguous
        "fixedbugs/issue16428.go",  // types2 reports two instead of one error
        "fixedbugs/issue17038.go",  // types2 doesn't report a follow-on error (pref: types2)
        "fixedbugs/issue17645.go",  // multiple errors on same line