go tparams 源码

  • 2022-07-15
  • 浏览 (1153)

golang tparams 代码

文件路径:/src/cmd/compile/internal/syntax/testdata/tparams.go

// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package p

type t[a, b /* ERROR missing type constraint */ ] struct{}
type t[a t, b t, c /* ERROR missing type constraint */ ] struct{}
type t struct {
	t [n]byte
	t[a]
	t[a, b]
}
type t interface {
	t[a]
	m /* ERROR method must have no type parameters */ [_ _, /* ERROR mixed */ _]()
	t[a, b]
}

func f[ /* ERROR empty type parameter list */ ]()
func f[a, b /* ERROR missing type constraint */ ]()
func f[a t, b t, c /* ERROR missing type constraint */ ]()

func f[a b,  /* ERROR expecting ] */ 0] ()

// issue #49482
type (
	t[a *[]int] struct{}
	t[a *t,] struct{}
	t[a *t|[]int] struct{}
	t[a *t|t,] struct{}
	t[a *t|~t,] struct{}
	t[a *struct{}|t] struct{}
	t[a *t|struct{}] struct{}
	t[a *struct{}|~t] struct{}
)

// issue #51488
type (
	t[a *t|t,] struct{}
	t[a *t|t, b t] struct{}
	t[a *t|t] struct{}
	t[a *[]t|t] struct{}
	t[a ([]t)] struct{}
	t[a ([]t)|t] struct{}
)

相关信息

go 源码目录

相关文章

go chans 源码

go fallthrough 源码

go interface 源码

go issue20789 源码

go issue23385 源码

go issue23434 源码

go issue31092 源码

go issue43527 源码

go issue43674 源码

go issue46558 源码

0  赞