golang.org/x/tools@v0.21.1-0.20240520172518-788d39e776b1/go/ssa/interp/testdata/fixedbugs/issue55115.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import "reflect" 8 9 func main() { 10 type MyByte byte 11 type MyRune rune 12 type MyString string 13 14 a := []MyByte{'a', 'b', 'c'} 15 if s := string(a); s != "abc" { 16 panic(s) 17 } 18 19 b := []MyRune{'五', '五'} 20 if s := string(b); s != "五五" { 21 panic(s) 22 } 23 24 c := []MyByte{'l', 'o', 'r', 'e', 'm'} 25 if s := MyString(c); s != MyString("lorem") { 26 panic(s) 27 } 28 29 d := "lorem" 30 if a := []MyByte(d); !reflect.DeepEqual(a, []MyByte{'l', 'o', 'r', 'e', 'm'}) { 31 panic(a) 32 } 33 34 e := 42 35 if s := MyString(e); s != "*" { 36 panic(s) 37 } 38 }