summaryrefslogtreecommitdiff
path: root/test/convlit.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-22 12:30:02 -0500
committerRuss Cox <rsc@golang.org>2011-11-22 12:30:02 -0500
commit178abb7ec71c2e87e35b6c2bc4b11fbb70b7fc52 (patch)
tree0e598140f62dd0ef1b909b19b6931dcd1eeb8538 /test/convlit.go
parenta7a3d6ebd1bcb7c44af5aef82bb673e3a9e29d67 (diff)
downloadgo-178abb7ec71c2e87e35b6c2bc4b11fbb70b7fc52.tar.gz
allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are: type Tstring string type Tbyte []byte type Trune []rune string <-> string // ok string <-> []byte // ok string <-> []rune // ok string <-> Tstring // ok string <-> Tbyte // was illegal, now ok string <-> Trune // was illegal, now ok Tstring <-> string // ok Tstring <-> []byte // ok Tstring <-> []rune // ok Tstring <-> Tstring // ok Tstring <-> Tbyte // was illegal, now ok Tstring <-> Trune // was illegal, now ok Update spec, compiler, tests. Use in a few packages. We agreed on this a few months ago but never implemented it. Fixes issue 1707. R=golang-dev, gri, r CC=golang-dev http://codereview.appspot.com/5421057
Diffstat (limited to 'test/convlit.go')
-rw-r--r--test/convlit.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/convlit.go b/test/convlit.go
index 2e3b15bda..1e82d1f2f 100644
--- a/test/convlit.go
+++ b/test/convlit.go
@@ -54,12 +54,12 @@ var _ = []byte(ss)
var _ []rune = ss // ERROR "cannot use|incompatible|invalid"
var _ []byte = ss // ERROR "cannot use|incompatible|invalid"
-// named slice is not
+// named slice is now ok
type Trune []rune
type Tbyte []byte
-var _ = Trune("abc") // ERROR "convert|incompatible|invalid"
-var _ = Tbyte("abc") // ERROR "convert|incompatible|invalid"
+var _ = Trune("abc") // ok
+var _ = Tbyte("abc") // ok
// implicit is still not
var _ Trune = "abc" // ERROR "cannot use|incompatible|invalid"