This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 49 · Dec 1 – 7, 2025

Alias type parameter restriction relaxed

Worth knowinglanguage

What changed
The Go spec now allows a type parameter to appear on the right‑hand side of an alias type declaration, but only when the type parameter is declared in the same declaration.
Production impact
The source does not say.
Try it
Compile a package that declares type T[T any] = []T and observe that it is now accepted.
Source
github.com/golang/go/issues/75885

Understand it, then run it

Run it now

Todaygo
// This program demonstrates the relaxed alias rule.
// It defines a generic alias that uses a type parameter declared in the same statement.
package main

import "fmt"

// Generic alias: MySlice[T] is an alias for []T.
// The type parameter T is declared in the same line, which is now allowed.
type MySlice[T any] = []T

func main() {
	// Create a MySlice[int] and populate it.
	var nums MySlice[int] = MySlice[int]{1, 2, 3}
	fmt.Println(nums) // Output: [1 2 3]
}

What it printed when we ran it on Go 1.27.1

[1 2 3]

Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed