]> Cypherpunks repositories - gostls13.git/commit
go/types: avoid closure allocations in mono check
authorMatthew Dempsky <mdempsky@google.com>
Tue, 2 Nov 2021 18:23:34 +0000 (11:23 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 2 Nov 2021 19:56:02 +0000 (19:56 +0000)
commitc45c32b1cd6ba635fda3add12f48766fd6aef5d8
tree9752c3e1738d9da628807ea7abd530de85a13927
parent1011e26b9cec8b5e7b0b827805b2fe079904521a
go/types: avoid closure allocations in mono check

This CL replaces monoEdge's "report" field with fields "pos" and
"typ", and pushes the logic for formatting them into the report
loop. This avoids needing to allocate a function closure for each
edge.

Also tweak a test case so the two type parameters involved in the
cycle aren't both "T" so they're easier to understand.

Change-Id: I9d392ad1d99a4c5e89da4613084e885149ebad07
Reviewed-on: https://go-review.googlesource.com/c/go/+/360815
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/mono.go
src/go/types/mono_test.go