mirror of
https://github.com/golang/go
synced 2024-11-26 04:07:59 -07:00
[dev.typeparams] cmd/compile/internal/types2: fix a bug in package qualification logic
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>
This commit is contained in:
parent
996b0dbc65
commit
b93f646125
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user