1 // errchk $G -e $D/$F.go
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test that basic operations on named types are valid
8 // and preserve the type.
23 func asString(String
) {}
40 asBool(1 != 2) // ERROR "cannot use.*type bool.*as type Bool"
41 asBool(i
< j
) // ERROR "cannot use.*type bool.*as type Bool"
43 _
, b
= m
[2] // ERROR "cannot .* bool.*type Bool"
44 m
[2] = 1, b
// ERROR "cannot use.*type Bool.*as type bool"
46 b
= c
<- 1 // ERROR "cannot use.*type bool.*type Bool"
48 asBool(c
<- 1) // ERROR "cannot use.*type bool.*as type Bool"
50 _
, b
= <-c
// ERROR "cannot .* bool.*type Bool"
54 _
, b
= inter
.(Map
) // ERROR "cannot .* bool.*type Bool"
57 var minter
interface {
60 _
, b
= minter
.(Map
) // ERROR "cannot .* bool.*type Bool"
63 asBool(closed(c
)) // ERROR "cannot use.*type bool.*as type Bool"
64 b
= closed(c
) // ERROR "cannot use.*type bool.*type Bool"
67 asString(String(slice
)) // ERROR "cannot .*type Slice.*type String"