golang/go

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

オープン

#78,342 opened on 2026/03/25

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Go (19,008 件のフォーク)batch import

Repository metrics

Stars
 (133,883 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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.

コントリビューターガイド