[go] go/types, types2: in resolveUnderlying, only compute path when needed

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Oct 22, 2025, 11:22:07 AM (22 hours ago) Oct 22
to Robert Griesemer, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Mark Freeman, golang-co...@googlegroups.com

Gopher Robot submitted the change with unreviewed changes

Unreviewed changes

2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/cmd/compile/internal/types2/named.go
Insertions: 25, Deletions: 9.

The diff is too large to show. Please review the diff.
```
```
The name of the file: src/go/types/named.go
Insertions: 25, Deletions: 9.

The diff is too large to show. Please review the diff.
```

Change information

Commit message:
go/types, types2: in resolveUnderlying, only compute path when needed

When following a RHS chain, the (TypeName) Object path is only needed
when there is a cycle (i.e., an error), in which case we can be slow.
Rather than always compute the path, only compute it in the error case.
In the same vain, allocate the seen map lazily, only when needed.

This code could use a test (it doesn't seem to be encountered by our
test suite), but I haven't found a case to provoke the error yet.
Change-Id: Iff6313394442a251adc56580f746928ec13450fd
Auto-Submit: Robert Griesemer <g...@google.com>
Reviewed-by: Mark Freeman <markf...@google.com>
Reviewed-by: Robert Griesemer <g...@google.com>
Files:
  • M src/cmd/compile/internal/types2/named.go
  • M src/go/types/named.go
Change size: S
Delta: 2 files changed, 22 insertions(+), 10 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Robert Griesemer, +2 by Mark Freeman
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Iff6313394442a251adc56580f746928ec13450fd
Gerrit-Change-Number: 712321
Gerrit-PatchSet: 6
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages