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 | 178abb7ec71c2e87e35b6c2bc4b11fbb70b7fc52 (patch) | |
tree | 0e598140f62dd0ef1b909b19b6931dcd1eeb8538 /test/named1.go | |
parent | a7a3d6ebd1bcb7c44af5aef82bb673e3a9e29d67 (diff) | |
download | go-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/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 fe71df844..64e492886 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 } |