golang/go

cmd/compile: exponential compile-time with nested generic instantiations

Aberta

#78.342 aberto em 25 de mar. de 2026

 (2 comentários) (0 reação) (0 responsável)Go (19.008 forks)batch import

Métricas do repositório

Stars
 (133.883 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

Go version

go 1.26.1 / tip

Output of go env in your module/workspace:

GOARCH=arm64

What did you do?

case 1:

package p

type T[P any] struct { _,_,_,_,_,_,_,_ P }

type U T[T[T[T[T[T[T[T[T[T[int]]]]]]]]]]

case 2:

package p

type T[P any] struct { _,_,_,_,_,_,_,_ P }

type U T[T[T[T[T[T[T[T[T[T[T[int]]]]]]]]]]]

case 3:

package p

type T[P any] struct { _,_,_,_,_,_,_,_ P }

type U T[T[T[T[T[T[T[T[T[T[T[T[int]]]]]]]]]]]]

Run go build on the above and measure the time.

What did you see happen?

Very long compile time.

What did you expect to see?

Fast compilation.

Guia do colaborador