]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile/internal/types2: report unused packages in source order
authorRobert Griesemer <gri@golang.org>
Tue, 26 Jan 2021 20:08:18 +0000 (12:08 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 27 Jan 2021 19:42:42 +0000 (19:42 +0000)
commit217a461f56cecee1756bef29f9ad2dcd389a255b
tree8917d7d61a7645069c0d6296b9e2570c3a8241ba
parent08a598f8c1c123fda3b7ad30659fa05a8be1ccde
[dev.typeparams] cmd/compile/internal/types2: report unused packages in source order

1) Rather than map-iterate through all file scopes and collect unused
   packages, collect all imports in the Checker.imports list so that
   errors are reported in source order.

2) From cmd/compile, borrow the idea of a "dotImportRefs" map to map
   dot-imported objects to the package they were dot-imported through
   (we call the map "dotImportMap").

3) From cmd/compile, borrow the "pkgnotused" function
   (called Checker.errorUnusedPkg in this code) and clean up
   unused package error reporting.

4) Adjust unused package error message to match compiler message exactly.

5) Enable one more excluded test case in test/run.go.

Change-Id: I4e4e55512a6043a7fd54f576c7441e3dd4077d6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/287072
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/check.go
src/cmd/compile/internal/types2/resolver.go
src/cmd/compile/internal/types2/testdata/importdecl0/importdecl0b.src
src/cmd/compile/internal/types2/testdata/importdecl1/importdecl1b.src
src/cmd/compile/internal/types2/typexpr.go
test/run.go