go compliterals 源码

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

golang compliterals 代码

文件路径:/src/cmd/compile/internal/types2/testdata/check/compliterals.go

// Copyright 2012 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.

// Composite literals with parameterized types

package comp_literals

type myStruct struct {
	f int
}

type slice[E any] []E

func struct_literals[S struct{f int}|myStruct]() {
	_ = S{}
	_ = S{0}
	_ = S{f: 0}

        _ = slice[int]{1, 2, 3}
        _ = slice[S]{{}, {0}, {f:0}}
}

相关信息

go 源码目录

相关文章

go blank 源码

go builtins0 源码

go builtins1 源码

go chans 源码

go const0 源码

go const1 源码

go constdecl 源码

go conversions0 源码

go conversions1 源码

go cycles0 源码

0  赞