golang/go

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

开放

#78,342 创建于 2026年3月25日

 (2 条评论) (0 个反应) (0 位负责人)Go (19,008 个派生)batch import

仓库指标

星标
 (133,883 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南