1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:50:22 -07:00

cmd/compile: allow converting defined string types to []rune

Fixes #23298

Change-Id: I107c6f3a80db83f063c0daf262c6e7f7492e4d4c
Reviewed-on: https://go-review.googlesource.com/87695
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Kunpei Sakai 2018-01-14 04:05:21 +09:00 committed by Matthew Dempsky
parent f04eebfdf5
commit bcb563f4db
2 changed files with 15 additions and 1 deletions

View File

@ -1665,7 +1665,7 @@ opswitch:
a = nod(OADDR, temp(t), nil)
}
n = mkcall("stringtoslicerune", n.Type, init, a, n.Left)
n = mkcall("stringtoslicerune", n.Type, init, a, conv(n.Left, types.Types[TSTRING]))
// ifaceeq(i1 any-1, i2 any-2) (ret bool);
case OCMPIFACE:

View File

@ -0,0 +1,14 @@
// compile
// Copyright 2018 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 string
var (
t = T("T")
r = []rune(t)
)