GoPLS Viewer

Home|gopls/go/ssa/testdata/structconv.go
1// +build ignore
2
3// This file is the input to TestValueForExprStructConv in identical_test.go,
4// which uses the same framework as TestValueForExpr does in source_test.go.
5//
6// In Go 1.8, struct conversions are permitted even when the struct types have
7// different tags. This wasn't permitted in earlier versions of Go, so this file
8// exists separately from valueforexpr.go to just test this behavior in Go 1.8
9// and later.
10
11package main
12
13type t1 struct {
14    x int
15}
16type t2 struct {
17    x int `tag`
18}
19
20func main() {
21    var tv1 t1
22    var tv2 t2 = /*@ChangeType*/ (t2(tv1))
23    _ = tv2
24}
25
MembersX
main.BlockStmt.tv2
t1
t1.x
t2
t2.x
main.BlockStmt.tv1
Members
X