diff options
author | Russ Cox <rsc@golang.org> | 2011-11-22 12:30:02 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-11-22 12:30:02 -0500 |
commit | 6e3e3809231c71fc30b6d0cdcb1f60c5e6e816ef (patch) | |
tree | e1e48c198bc31ca4fe901fac630758382db1151c /test/named1.go | |
parent | c69d6345daf277b947341ba958458b0a500effe1 (diff) | |
download | go-6e3e3809231c71fc30b6d0cdcb1f60c5e6e816ef.tar.gz go-6e3e3809231c71fc30b6d0cdcb1f60c5e6e816ef.zip |
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 #1707.
R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
Diffstat (limited to 'test/named1.go')
-rw-r--r-- | test/named1.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/named1.go b/test/named1.go index fe71df844f..64e492886e 100644 --- a/test/named1.go +++ b/test/named1.go @@ -54,8 +54,8 @@ func main() { _, bb := <-c asBool(bb) // ERROR "cannot use.*type bool.*as type Bool" - _, b = <-c // ERROR "cannot .* bool.*type Bool" + _, b = <-c // ERROR "cannot .* bool.*type Bool" _ = b - asString(String(slice)) // ERROR "cannot .*type Slice.*type String" + asString(String(slice)) // ok } |